Get paginator associated with current listing

@return Paginator
340079
protected function createPaginator()
    {
        $paginator = new Paginator($this->getLimit());
        $paginator = $paginator->withPage($this->getPage());

        return $paginator;
    }
260367
public function getPaginatedAndOrdered()
    {
        $direction = request()->get('direction');
        $orderBy = request()->get('orderby');

        $p = config('admin.paginate');

        if($orderBy)
            return $this->orderBy($orderBy, $direction)->paginate($p);
        return $this->paginate();
    }
230155
public function getAll()
    {
        $model = new static::$model;

        $query = $model::with($model::$localWith);
        $this->qualifyCollectionQuery($query);

        // Handle pagination, if applicable
        $perPage = $model->getPerPage();
        if ($perPage) {
            $paginator = $query->paginate($perPage);

            return $this->response->paginator($paginator, $this->getTransformer());
        } else {
            $resources = $query->get();

            return $this->response->collection($resources, $this->getTransformer());
        }
    }
987333
public function getPaginationControl(PaginatorInterface $paginator) {
		$currentPage = $paginator->getCurrentPage();
		
		$data = [
			PaginatorInterface::CONTROL_CURRENT => $currentPage,
			PaginatorInterface::CONTROL_RANGE   => [$currentPage]
		];
		
		if ($currentPage > 2) {
			$data[PaginatorInterface::CONTROL_FIRST] = 1;
		}
		
		if ($currentPage > 1) {
			$data[PaginatorInterface::CONTROL_PREVIOUS] = $currentPage - 1;
		}
		
		if ($paginator->count() >= $paginator->getItemsNumberPerPage()) {
			$data[PaginatorInterface::CONTROL_NEXT] = $currentPage + 1;
		}
		
		return $data;
	}
912142
protected function getPreviousButton()
    {
        if ($this->paginator->currentPage() <= 1) {
            return $this->getDisabledLink($this->previousButtonText);
        }

        $url = $this->paginator->url(
            $this->paginator->currentPage() - 1
        );

        return $this->getPrevNextPageLinkWrapper($url, $this->previousButtonText, 'prev');
    }
888415
public function paginate()
    {
        $model = $this->model;

        if (property_exists($model, 'order')) {
            $paginator = $model::orderBy($model::$order, $model::$sort)->paginate($model::$paginate, $model::$index);
        } else {
            $paginator = $model::paginate($model::$paginate, $model::$index);
        }

        if (!$this->isPageInRange($paginator) && !$this->isFirstPage($paginator)) {
            throw new NotFoundHttpException();
        }

        if (count($paginator)) {
            $this->paginateLinks = $paginator->render();
        }

        return $paginator;
    }
1223679
public function getPages(Paginator $paginator, $pageRange = null)
    {
        $pageRange  = $paginator->getPageRange();
        $pageNumber = $paginator->getCurrentPageNumber();

        $originalPageRange = $pageRange;
        $pageRange         = $pageRange * 2 - 1;

        if ($originalPageRange + $pageNumber - 1 < $pageRange) {
            $pageRange = $originalPageRange + $pageNumber - 1;
        } elseif ($originalPageRange + $pageNumber - 1 > count($paginator)) {
            $pageRange = $originalPageRange + count($paginator) - $pageNumber;
        }

        return parent::getPages($paginator, $pageRange);
    }
407955
public function paginate()
    {
        if(!$this->skipCriteria) {
            foreach($this->getterCriteria as $criteria) {
                $this->repository = $this->repository->pushCriteria(app($criteria));
            }
        }
        if(!$this->skipRelations) {
            $this->repository = $this->repository->with($this->relations);
        }

        return $this->repository->paginate();
    }
436215
public function getIterator()
    {
        $iterator = parent::getIterator();

        if ( $this->id )
        {
            $iterator->append( new ArrayIterator( array(
                'seoUri' => $this->getSeoUri(),
            ) ) );
        }

        return $iterator;
    }
776344
protected function createPaginationObject()
    {
        $adapter = new DoctrineDbalAdapter(
            $this->deliverQueryObject(),
            function (\Doctrine\DBAL\Query\QueryBuilder $query) {
                $query
                    ->resetQueryParts(['groupBy', 'orderBy'])
                    ->select('count(distinct p.id)')
                    ->setMaxResults(1);
            }
        );
        $pagination = new Pagination($this, $adapter);

        return $pagination;
    }
726838
public function PaginatedList()
    {
        $all_posts = $this->blogPosts ?: ArrayList::create();

        $posts = PaginatedList::create($all_posts);

        $posts->setPageLength($this->PostsPerPage);

        // Set current page
        $start = $this->request->getVar($posts->getPaginationGetVar());
        $posts->setPageStart($start);

        return $posts;
    }
380252
protected function _getPaginatorResponse()
    {
        $totalItems = $this->_getTotalItemsCount();
        $resource   = $this->getResource();
        $data       = $this->getData();

        return array(
            'current_page_number' => !empty($resource) ? $this->getResource('page') : null,
            'total_item_count'    => $totalItems,
            'item_count_per_page' => !empty($resource) ? $this->getResource('per_page') : null,
            'current_item_count'  => count($data),
            'page_count'          => !empty($resource) ? ceil($totalItems / $this->getResource('per_page')) : 0,
            'current_items'       => $data
        );
    }
626065
public function paginator(PaginatorInterface $paginator)
	{
		$currentPage = (int) $paginator->getCurrentPage();
		$lastPage    = (int) $paginator->getLastPage();

		$pagination = [
			'total'        => (int) $paginator->getTotal(),
			'count'        => (int) $paginator->getCount(),
			'per_page'     => (int) $paginator->getPerPage(),
			'current_page' => $currentPage,
			'total_pages'  => $lastPage,
		];

		$pagination['links'] = [
			'next'     => null,
			'previous' => null,
		];

		$this->applyRequestQueryParams($paginator->getPaginator());

		if ($currentPage > 1) {
			$pagination['links']['previous'] = $paginator->getUrl($currentPage - 1);
		}

		if ($currentPage < $lastPage) {
			$pagination['links']['next'] = $paginator->getUrl($currentPage + 1);
		}

		return ['pagination' => $pagination];
	}
1008727
public function index()
    {
        $groups = ComponentGroup::query();
        if (!$this->guard->check()) {
            $groups = ComponentGroup::visible();
        }

        $groups->search(Binput::except(['sort', 'order', 'per_page']));

        if ($sortBy = Binput::get('sort')) {
            $direction = Binput::get('order', 'asc');

            $groups->sort($sortBy, $direction);
        }

        $groups = $groups->paginate(Binput::get('per_page', 20));

        return $this->paginator($groups, Request::instance());
    }
641109
public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
305757
public function build(): Pagination
    {
        return new Pagination(
            $this->items_per_page,
            $this->items_count,
            $this->current_page,
            $this->pages_range
        );
    }
1154515
public function getIterator()
    {
        if (null === $this->queue) {
            $this->queue = new SplPriorityQueue();
            $this->queueOrder = 0;
            foreach (parent::getIterator() as $filter) {
                $this->queue->insert(
                    $filter,
                    array($this->priorities[$filter->getName()], $this->queueOrder--)
                );
            }
        }
        return clone $this->queue;
    }