Perform pagination.

@return void
519479
public function paging()
    {
        $limit = (int) $this->request->input('length') > 0 ? $this->request->input('length') : 10;
        if (is_callable($this->limitCallback)) {
            $this->query->limit($limit);
            call_user_func_array($this->limitCallback, [$this->query]);
        } else {
            $this->query->skip($this->request->input('start'))->take($limit);
        }
    }
748765
public function render()
    {
        $paginationData = $this->paginator->getPages();
        $previous       = $this->getElement()->spawnChild('li');
        $next           = $this->getElement()->spawnChild('li');
        $previousAnchor = $previous->spawnChild('a')->setContent($this->getPrevLabel());
        $nextAnchor     = $next->spawnChild('a')->setContent($this->getNextLabel());

        $this->getElement()->addAttributes($this->getListAttributes());

        $previousAnchor->setAttributes($this->getPreviousAttributes());
        $nextAnchor->setAttributes($this->getNextAttributes());

        if (empty($paginationData->previous)) {
            $previous->addClass('disabled');
        } else {
            $previousAnchor->addAttribute('data-page', $paginationData->previous);
            $previousAnchor->addAttribute('href', $this->getUrl(
                $this->getRoute(),
                array_merge(
                    array('page' => $paginationData->previous),
                    $this->getRouteParams()
                )
            ));
        }

        if (empty($paginationData->next)) {
            $next->addClass('disabled');
        } else {
            $nextAnchor->addAttribute('data-page', $paginationData->next);
            $nextAnchor->addAttribute('href', $this->getUrl(
                $this->getRoute(),
                array_merge(
                    array('page' => $paginationData->next),
                    $this->getRouteParams()
                )
            ));
        }

        if ($this->align) {
            $previous->addClass('previous');
            $next->addClass('next');
        }

        return $this->getElement()->render();
    }
1084668
public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/pagination.php' => config_path('pagination.php'),
        ], 'pagination');

        $this->mergeConfigFrom(__DIR__.'/../config/pagination.php', 'pagination');

        Request::macro('paginationCount', function ($key = null) {
            $defaultCount = config('pagination.defaultCount');
            $maximumCount = config('pagination.maximumCount');
            $paginationKey = $key ?? config('pagination.key');

            return min(
                intval($this->query($paginationKey, $defaultCount)),
                $maximumCount
            );
        });
    }
350730
protected function buildPagination()
    {
        $this->calculateDisplayRange();
        $pages = array();
        for ($i = $this->displayRangeStart; $i <= $this->displayRangeEnd; $i++) {
            $pages[] = array('number' => $i, 'isCurrent' => ($i === $this->currentPage));
        }
        $pagination = array(
            'pages' => $pages,
            'current' => $this->currentPage,
            'numberOfPages' => $this->numberOfPages,
            'displayRangeStart' => $this->displayRangeStart,
            'displayRangeEnd' => $this->displayRangeEnd,
            'hasLessPages' => $this->displayRangeStart > 2,
            'hasMorePages' => $this->displayRangeEnd + 1 < $this->numberOfPages
        );
        if ($this->currentPage < $this->numberOfPages) {
            $pagination['nextPage'] = $this->currentPage + 1;
        }
        if ($this->currentPage > 1) {
            $pagination['previousPage'] = $this->currentPage - 1;
        }
        return $pagination;
    }
233962
public function iteratePages()
    {
        $currentPage = $this;
        yield $this;
        while ($currentPage->hasNextPage()) {
            $currentPage = $currentPage->getNextPage();
            yield $currentPage;
        }
    }
1362542
public function paging()
    {
        $this->collection = $this->collection->slice(
                $this->request['start'], (int) $this->request['length'] > 0 ? $this->request['length'] : 25
        );
    }
719180
public function paging()
    {
        $this->query->skip($this->request['start'])
                ->take((int) $this->request['length'] > 0 ? $this->request['length'] : 25);
    }
1123414
public function render()
    {
        // Run only in case paginator has at least one page
        if ($this->paginator->hasPages()) {
            $ulClass = $this->getOption('ulClass', 'pagination');
            return $this->renderList($ulClass, $this->createPaginationItems());
        }
    }
1291448
public function index()
    {
        $subscribers = Subscriber::paginate(Binput::get('per_page', 20));

        return $this->paginator($subscribers, Request::instance());
    }
861459
public function next()
    {
        ++$this->current_position;

        if(!$this->valid()) {
            $this->current_response = $this->next_response();
            $this->current_page_position = $this->current_position;
        }
    }
756247
public function pagination()
    {
        if ($this->pagination === null) {
            $this->pagination = $this->createPagination();
        }

        return $this->pagination;
    }
641070
public function next()
	{
		$pageSize=$this->_dataProvider->getPagination()->getPageSize();
		$this->_currentIndex++;
		if($this->_currentIndex >= $pageSize)
		{
			$this->_currentPage++;
			$this->_currentIndex=0;
			$this->loadPage();
		}
	}
158562
public function index()
    {
        $this->request->allowMethod('get');

        $query = $this->SavedSearches->find('all')
            ->where(['name IS NOT' => null])
            ->where(['name !=' => ''])
            ->where($this->request->getQueryParams());

        $entities = $this->paginate($query);

        $this->set('success', true);
        $this->set('data', $entities);
        $this->set('_serialize', ['success', 'data']);
    }
1177460
public function index()
    {
        $this->paginate = [
            'order' => ['unique_string'=>'DESC']
        ];
        
        $this->set('permission', $this->paginate($this->Permission));
        $this->set('_serialize', ['permission']);
    }
84933
protected function paginationCount(): int
	{
		$clone = (clone $this)->clearOrderings();

		if(empty($this->groupings) && $this->distinct === false)
		{
			return $clone->count();
		}

		return $this->newInstance()->table(new Subquery($clone, 'count'))->count();
	}
877915
public function index()
    {
        $this->paginate['order'] = ['title' => 'ASC'];

        $positions = $this->paginate($this->BannersPositions->find());

        $this->set(compact('positions'));
    }
88545
public function paginate()
    {
        $totalCount = $this->getCount();

        $pageCount = $this->maxResults ? intval(ceil($totalCount / $this->maxResults)) : 1;
        $current = $this->page;
        $pageRange = 5;

        if ($pageCount < $current) {
            $current = $pageCount;
        }

        if ($pageRange > $pageCount) {
            $pageRange = $pageCount;
        }

        $delta = ceil($pageRange / 2);

        if ($current - $delta > $pageCount - $pageRange) {
            $pages = range($pageCount - $pageRange + 1, $pageCount);
        } else {
            if ($current - $delta < 0) {
                $delta = $current;
            }

            $offset = $current - $delta;
            $pages = range($offset + 1, $offset + $pageRange);
        }

        $proximity = floor($pageRange / 2);

        $startPage = $current - $proximity;
        $endPage = $current + $proximity;

        if ($startPage < 1) {
            $endPage = min($endPage + (1 - $startPage), $pageCount);
            $startPage = 1;
        }

        if ($endPage > $pageCount) {
            $startPage = max($startPage - ($endPage - $pageCount), 1);
            $endPage = $pageCount;
        }

        $pagination = [
            'last' => (int)$pageCount,
            'current' => (int)$current,
            'numItemsPerPage' => $this->maxResults ?? ucfirst(self::ALL_PARAMETER),
            'first' => 1,
            'pageCount' => (int)$pageCount,
            'totalCount' => (int)$totalCount,
            'pageRange' => $pageRange,
            'startPage' => (int)$startPage,
            'endPage' => (int)$endPage,
            'route' => $this->route,
            'routeParams' => $this->routeParams,
            'query' => $this->queryFilter,
            'pageParameterName' => 'page',
            'sort' => $this->sort,
        ];

        if ($current - 1 > 0) {
            $pagination['previous'] = $current - 1;
        }

        if ($current + 1 <= $pageCount) {
            $pagination['next'] = $current + 1;
        }

        $pagination['pagesInRange'] = $pages;
        $pagination['firstPageInRange'] = min($pages);
        $pagination['lastPageInRange'] = max($pages);

        $items = $this->getRecords();
        if ($items !== null) {
            $pagination['currentItemCount'] = (int)$totalCount;
            $pagination['firstItemNumber'] = $this->maxResults ? (($current - 1) * $this->maxResults) + 1 : 1;
            $pagination['lastItemNumber'] =  $pagination['firstItemNumber'] + $pagination['currentItemCount'] - 1;
        }

        return [
            'items' => $items,
            'pagination' => $pagination
        ];
    }