Returns an array containing all page numbers

@param int $totalPages
@param int $currentPage

@return array
353099
protected function getPages($totalPages, $currentPage)
    {
        $range = range(1, $totalPages);
        $pages = [];
        foreach ($range as $page) {
            $pages[] = [
                'number' => $page,
                'active' => (int)$page === (int)$currentPage
            ];
        }

        return $pages;
    }
237163
public function getPages()
    {
        $pages = [];

        foreach ($this->getLowers() as $lower) {
            $pages[$lower] = Pagination::LOWER;
        }

        if ($this->getCurrent()) {
            $pages[$this->getCurrent()] = Pagination::CURRENT;
        }

        foreach ($this->getHighers() as $higher) {
            $pages[$higher] = Pagination::HIGHER;
        }

        ksort($pages);

        return $pages;
    }
304119
public function getTotalPages()
    {
        if (empty($this->totalPages)) {
            $this->totalPages = (int)ceil($this->getCursor()->count()/$this->limit);
        }

        return $this->totalPages;
    }
981017
protected function calculateLinks($currentPage, $numberOfPages)
    {
        $baseUrl = $this->getBaseUrl();
        $prev = ($currentPage > 1) ? $currentPage - 1 : null;
        $next = ($currentPage < $numberOfPages) ? $currentPage + 1 : null;

        $separator = ($this->paginationLink) ? '/' : '?page=';

        return [
            'current' => $baseUrl.$separator.$currentPage,
            'prev' => ($prev) ? $baseUrl.$separator.$prev : null,
            'next' => ($next) ? $baseUrl.$separator.$next : null,
            'last' => ($numberOfPages > 0) ? $baseUrl.$separator.$numberOfPages : null,
        ];
    }
1201229
protected function calculateCurrentPage($lastPage)
	{
		$page = $this->env->getCurrentPage();

		// The page number will get validated and adjusted if it either less than one
		// or greater than the last page available based on the count of the given
		// items array. If it's greater than the last, we'll give back the last.
		if (is_numeric($page) && $page > $lastPage)
		{
			return $lastPage > 0 ? $lastPage : 1;
		}

		return $this->isValidPageNumber($page) ? (int) $page : 1;
	}
19057
public function getCurrentPage($total = null)
	{
		if (is_null($total))
		{
			return $this->currentPage;
		}
		else
		{
			return min($this->currentPage, (int) ceil($total / $this->perPage));
		}
	}
38964
public function getPageNumbers()
    {
        $pages = range(1, $this->getPagesCount());

        // And has an styling adapter
        if ($this->getPagesCount() > 10 && $this->hasAdapter()) {
            return $this->style->getPageNumbers($pages, $this->getCurrentPage());
        } else {
            return $pages;
        }
    }
684551
public function indexAction($currentPage = 1)
    {
        // set current page
        $this->currentPage = (int)$currentPage;
        if ($this->currentPage < 1) {
            $this->currentPage = 1;
        }
        if ($this->currentPage > $this->numberOfPages) {
            // set $modifiedObjects to NULL if the page does not exist
            $modifiedObjects = null;
        } else {
            // modify query
            $this->itemsPerPage = (int)$this->configuration['itemsPerPage'];
            $this->offset = $this->itemsPerPage * ($this->currentPage - 1);
            // use slice here for array support
            $modifiedObjects = $this->prepareObjectsSlice($this->itemsPerPage, $this->offset);
        }
        $this->view->assign('contentArguments', [
            $this->widgetConfiguration['as'] => $modifiedObjects,
        ]);
        $this->view->assign('configuration', $this->configuration);
        $this->view->assign('pagination', $this->buildPagination());
    }
393323
protected function getNextPage($totalPages, $offset, $limit)
    {
        $nextPage = ($offset / $limit) + 2;
        if ($nextPage > $totalPages) {
            return null;
        }

        return $nextPage;
    }
789420
public function getPages()
	{
		return $this->total > $this->limit ? ceil($this->total / $this->limit) : 1;
	}
1231598
public function getMyNumPage($page = null)
    {
        if ($page === null) {
            $page = $this->page;
        }

        if ($this->_myLastPageGroupNb == 0) {
            return $page;
        } else {
            return $page-$this->_myLastPageGroup;
        }
    }
1188028
public function get_slots($page = 'all') {
        if ($page === 'all') {
            $numbers = array();
            foreach ($this->pagelayout as $numbersonpage) {
                $numbers = array_merge($numbers, $numbersonpage);
            }
            return $numbers;
        } else {
            return $this->pagelayout[$page];
        }
    }
8177
public function getPages()
    {
        $pages = array();

        if ($this->pages <= 1) {
            return array();
        }

        if ($this->pages <= $this->limit_pages) {
            for ($i = 1; $i <= $this->pages; $i++) {
                $pages[] = $this->createPage($i, $i == $this->current);
            }

            return $pages;
        }

        $num_adjacents = (int) floor(($this->limit_pages - 3) / 2);

        if ($this->current + $num_adjacents > $this->pages) {
            $sliding_start = $this->pages - $this->limit_pages + 2;
        } else {
            $sliding_start = $this->current - $num_adjacents;
        }

        if ($sliding_start < 2) {
            $sliding_start = 2;
        }

        $sliding_end = $sliding_start + $this->limit_pages - 3;

        if ($sliding_end >= $this->pages) {
            $sliding_end = $this->pages - 1;
        }

        $pages[] = $this->createPage(1, $this->current == 1);

        if ($sliding_start > 2) {
            $pages[] = $this->createPageEllipsis();
        }

        for ($i = $sliding_start; $i <= $sliding_end; $i++) {
            $pages[] = $this->createPage($i, $i == $this->current);
        }

        if ($sliding_end < $this->pages - 1) {
            $pages[] = $this->createPageEllipsis();
        }

        $pages[] = $this->createPage($this->pages, $this->current == $this->pages);

        return $pages;
    }
931983
public function getPageNumbers(array $pages, $current)
    {
        $result = array();
        $amount = count($pages);
        $start = 3;

        if ($amount > $start) {

            // this specifies the range of pages we want to show in the middle
            $min = max($current - 2, 2);
            $max = min($current + 2, $amount - 1);

            // we always show the first page
            $result[] = 1;

            // we're more than one space away from the beginning, so we need a separator
            if ($min > 2) {
                $result[] = '...';
            }

            // generate the middle numbers
            for ($i = $min; $i < $max + 1; $i++) {
                $result[] = $i;
            }

            // we're more than one space away from the end, so we need a separator
            if ($max < $amount - 1) {
                $result[] = '...';
            }

            // we always show the last page, which is the same as amount
            $result[] = $amount;

            return $result;

        } else {

            // It's not worth using a style adapter, because amount of pages is less than 3
            return range(1, $start);
        }
    }
1093609
public function getCurrentPageStrategyInstance()
    {
        if ($this->currentPageStrategy === null) {
            $this->currentPageStrategy = new CurrentPageStrategyImpl($this);
        }
        return $this->currentPageStrategy;
    }
872203
public function total_pages( $limit = null, $offset = null, $total = null ) {

		$this->do_hook( 'total_pages' );

		if ( null === $limit ) {
			$limit = $this->limit;
		}

		if ( null === $offset ) {
			$offset = $this->offset;
		}

		if ( null === $total ) {
			$total = $this->total_found();
		}

		return ceil( ( $total - $offset ) / $limit );

	}
340255
public function getPages()
    {
        $numAdjacents = (int) floor(($this->maxPages - 3) / 2);

        if ($this->currentPage + $numAdjacents > $this->numPages) {
            $begin = $this->numPages - $this->maxPages + 2;
        } else {
            $begin = $this->currentPage - $numAdjacents;
        }
        if ($begin < 2) {
            $begin = 2;
        }

        $end = $begin + $this->maxPages - 2;
//        if ($end >= $this->numPages) $end = $this->numPages - 1;

//        $tmpBegin = $this->maxPages - floor($this->maxPages / 2);
//        $tmpEnd = $tmpBegin + $this->maxPages - 1;
//
//        if ($tmpBegin < 1) {
//            $tmpEnd += 1 - $tmpBegin;
//            $tmpBegin = 1;
//        }
//
//        if ($tmpEnd > $this->getLastPage()) {
//            $tmpBegin -= $tmpEnd - $this->getLastPage();
//            $tmpEnd = $this->getLastPage();
//        }
//
//        $begin = min($tmpBegin, 2);
//        $end = $tmpEnd;

        return range($begin, $end, 1);
    }