Paginates the current LDAP query.

@param int  $perPage
@param int  $currentPage
@param bool $isCritical

@return Paginator|bool
509845
public function paginate($perPage = 50, $currentPage = 0, $isCritical = true)
    {
        // Stores all LDAP entries in a page array
        $pages = [];

        $cookie = '';

        do {
            $this->connection->controlPagedResult($perPage, $isCritical, $cookie);

            $results = $this->connection->search($this->adldap->getBaseDn(), $this->getQuery(), $this->getSelects());

            if ($results) {
                $this->connection->controlPagedResultResponse($results, $cookie);

                $pages[] = $results;
            }
        } while ($cookie !== null && !empty($cookie));

        if (count($pages) > 0) {
            return $this->processPaginatedResults($pages, $perPage, $currentPage);
        }

        return false;
    }
916863
protected function getFilterPager(Query $query, $currentPage, $maxPerPage)
    {
        $adapter = new FilterAdapter($query, $this->getSite()->getFilterService());
        $pager = new Pagerfanta($adapter);

        $pager->setNormalizeOutOfRangePages(true);
        $pager->setMaxPerPage($maxPerPage);
        $pager->setCurrentPage($currentPage);

        return $pager;
    }
712729
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $page = $page ?: Paginator::resolveCurrentPage($pageName);

        $perPage = $perPage ?: $this->model->getPerPage();

        $results = ($total = $this->toBase()->getCountForPagination())
                                    ? $this->forPage($page, $perPage)->get($columns)
                                    : $this->model->newCollection();

        return $this->paginator($results, $total, $perPage, $page, [
            'path' => Paginator::resolveCurrentPath(),
            'pageName' => $pageName,
        ]);
    }
90460
public function paginate(
        $perPage = null,
        $columns = null,
        $pageName = null,
        $page = null,
        bool $lengthAware = true
    ) {
        $perPage = is_null($perPage) ? config('lego.paginator.per-page') : $perPage;
        $pageName = is_null($pageName) ? config('lego.paginator.page-name') : $pageName;
        $columns = is_null($columns) ? ['*'] : $columns;
        $page = $page ?: Request::query($pageName, 1);

        if ($lengthAware) {
            $this->paginator = $this->createLengthAwarePaginator($perPage, $columns, $pageName, $page);
        } else {
            $this->paginator = $this->createLengthNotAwarePaginator($perPage, $columns, $pageName, $page);
        }

        $this->paginator->setCollection(
            $this->paginator->getCollection()->map(function ($row) {
                return Finder::createStore($row);
            })
        );

        return $this->paginator;
    }
828588
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $columns = $this->shouldSelect($columns);

        $columns = array_diff($columns, [$this->getQualifiedFirstKeyName().' as laravel_through_key']);

        $this->query->addSelect($columns);

        return tap($this->query->paginate($perPage, $columns, $pageName, $page), function (Paginator $paginator) {
            $this->hydrateIntermediateRelations($paginator->items());
        });
    }
588882
protected function paginator($items, $total, $perPage, $currentPage, $options)
    {
        return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact(
            'items', 'total', 'perPage', 'currentPage', 'options'
        ));
    }
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());
    }
352702
protected function createContentSearchPager(Query $query, $currentPage, $maxPerPage)
    {
        @trigger_error(
            'PagerfantaFindTrait is deprecated since version 2.5 and will be removed in 3.0. Use PagerfantaTrait instead.',
            E_USER_DEPRECATED
        );

        $adapter = new ContentSearchAdapter($query, $this->getSite()->getFindService());

        return $this->getPager($adapter, $currentPage, $maxPerPage);
    }
616799
public function paginate($perPage = 30)
    {
        $page      = request()->input('page', 1);
        $items     = $this->slice(($page * $perPage) - $perPage, $perPage, true);
        $paginator = new LengthAwarePaginator($items, $this->count(), $perPage, $page);

        $paginator->setPath(request()->url());

        return $paginator;
    }
1103816
public function paginate($perPage = 25, $currentPage = null, array $options = [])
    {
        $currentPage = $this->getPageFromInput($currentPage, $options);
        $offset      = ($currentPage - 1) * $perPage;
        $total       = $this->count();
        $entries     = $this->get()->slice($offset, $perPage)->all();

        return new LengthAwarePaginator($entries, $total, $perPage, $currentPage, $options);
    }
1126290
static public function paginate($page, $per_page)
    {
        $query = self::createRelation();
        return $query->paginate($page, $per_page);
    }
880021
public function paginate($page, $per_page=10) {
		$this->page = $page = $page ? $page:1;
		$this->per_page = $per_page;
		$this->offset(($page-1)*$per_page);
		$this->limit($per_page);

		return $this;
	}
32176
public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page')
	{
		$this->query->addSelect($this->getSelectColumns($columns));

		return $this->query->simplePaginate($perPage, $columns, $pageName);
	}
273089
public function paginateRaw($perPage = null, $pageName = 'page', $page = null)
    {
        $engine = $this->engine();

        $page = $page ?: Paginator::resolveCurrentPage($pageName);

        $perPage = $perPage ?: $this->model->getPerPage();

        $results = $engine->paginate($this, $perPage, $page);

        $paginator = (new LengthAwarePaginator($results, $engine->getTotalCount($results), $perPage, $page, [
            'path' => Paginator::resolveCurrentPath(),
            'pageName' => $pageName,
        ]));

        return $paginator->appends('query', $this->query);
    }
1072895
public function forPage($page, $perPage = 15)
	{
		if( $page < 1 )
		{
			$page = 1;
		}
		return $this->limit($perPage, ($page - 1) * $perPage);
	}
752169
public function setPagination (int $currentPage=1, int $perPage=20, int $adjacent=1, int $totalCount=0)
    {
        $this->currentPage     	= $currentPage;
        $this->perPage         	= $perPage;
        $this->adjacent 		= $adjacent;
        $this->totalCount      	= $totalCount;
    }
776672
public function searchForPaginatedContent($searchText, $currentPage, $languages)
    {
        // Generating query
        $query = new Query();
        $query->query = new Criterion\FullText($searchText);
        $query->filter = new Criterion\LogicalAnd(
            array(
                new Criterion\Visibility(Criterion\Visibility::VISIBLE),
                new Criterion\LanguageCode($languages, true),
            )
        );

        // Initialize pagination.
        $pager = new Pagerfanta(
            new ContentSearchAdapter($query, $this->searchService)
        );
        $pager->setMaxPerPage($this->searchListLimit);
        $pager->setCurrentPage($currentPage);

        return $pager;
    }