public static function getPageOffsetAndLimit($pageNumber, $divider, $total = -1) {
        if ($pageNumber < 0 || $divider < 0) {
            return -1;
        }
        $offset = $pageNumber * $divider;
        $limit  = $divider;
        if (0 <= $total && ($total < $offset || $total < ($offset + $limit))) {
            $offset = (static::getPagesCount($total, $divider) - 1) * $divider;
            $limit  = $total - $offset;
        }
        return [$offset, $limit];
    }
public static function getPageOffsetAndLimit($pageNumber, $divider, $total = -1) {
        if ($pageNumber < 0 || $divider < 0) {
            return -1;
        }
        $offset = $pageNumber * $divider;
        $limit  = $divider;
        if (0 <= $total && ($total < $offset || $total < ($offset + $limit))) {
            $offset = (static::getPagesCount($total, $divider) - 1) * $divider;
            $limit  = $total - $offset;
        }
        return [$offset, $limit];
    }
public static function getPageOffsetAndLimit ( $ pageNumber , $ divider , $ total = - 1 ) { if ( $ pageNumber < 0 || $ divider < 0 ) { return - 1 ; } $ offset = $ pageNumber * $ divider ; $ limit = $ divider ; if ( 0 <= $ total && ( $ total < $ offset || $ total < ( $ offset + $ limit ) ) ) { $ offset = ( static :: getPagesCount ( $ total , $ divider ) - 1 ) * $ divider ; $ limit = $ total - $ offset ; } return [ $ offset , $ limit ] ; }
Get a page offset and limit.

@param int $pageNumber The page number.
@param int $divider The divider.
@param int $total The total.
@return int[] Returns the page offset and limit in case of success, -1 otherwise.
Get a page offset and limit .