Add the pages to the pagination

@param \Zepi\Web\UserInterface\Pagination\Pagination $pagination
@param integer $activePage
@param integer $neededPages
976175
protected function addPages(PaginationObject $pagination, $activePage, $neededPages)
    {
        // Add the pages
        for ($i = 1; $i <= $neededPages; $i++) {
            if ($i == $activePage) {
                $page = new ActivePage($i, $this->buildUrl($i));
                $pagination->addEntry($page);
            } else if ($i < 4 || $i > ($neededPages - 3) || ($i > ($activePage - 3) && $i < ($activePage + 3))) {
                $page = new Page($i, $this->buildUrl($i));
                $pagination->addEntry($page);
            } else if (!($pagination->getLatestEntry() instanceof Dots)) {
                $dots = new Dots();
                $pagination->addEntry($dots);
            }
        }
    }
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;
    }
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;
    }
853851
public function addPage(NavigationPageInterface &$page, $priority = 1)
    {
        intval($priority);

        $permissions = $page->getPermissions();
        if (! empty($permissions) and Gate::denies('navigation-page-view', $page)) {
            return $this;
        }

        if (isset($page->priority)) {
            $priority = (int) $page->priority;
        }

        if ($page instanceof static) {
            $this->addSection($page);
        } else {
            while (isset($this->pages[$priority])) {
                $priority++;
            }

            $this->pages[$priority] = $page;
            $page->setRootSection($this);
        }

        return $this->update()->sort();
    }
189992
public function queryPage(int $requestedPage): bool
    {
        // clear
        $this->page = 0;
        $this->totalRecords = null;
        $this->recordset = null;
        // request
        $page = min($this->getTotalPages(), max(1, $requestedPage));
        $query = $this->dbal->sqlLimit($this->getQueryData(), $page, $this->getPageSize());
        $recordset = $this->dbal->queryRecordset($query);
        if (false === $recordset) {
            return false;
        }
        $this->page = $page;
        $this->recordset = $recordset;
        return true;
    }
585847
public function processPaginated(array $pages = [], $perPage = 50, $currentPage = 0)
    {
        $models = [];

        foreach ($pages as $results) {
            // Go through each page and process the results into an objects array.
            $models = array_merge($models, $this->process($results));
        }

        $models = $this->processSort($models)->toArray();

        return $this->newPaginator($models, $perPage, $currentPage, count($pages));
    }
1258093
public function paginate($page, $per_page = 50) 
    {
        $this->_builder->limit  = $per_page;
        $this->_builder->offset = ($page - 1) * $per_page;
        $this->page             = $page;
        $this->per_page         = $per_page;

        if (Driver::$pagination_subquery) {
            $this->_builder->limit   = $this->_builder->offset + $per_page;
            $this->_builder->offset  = $this->_builder->offset + 1;
        }
        return $this;
    }
944868
public static function paginated($perPage, $item = [], $options = [], $query = null)
    {
        $request = new Request();

        if (is_null($query)) {
            $query = 'page';
        }

        if (!count($item)) {
            $item = static::all();
        }

        $currentPage = $request->input($query, null);
        if (is_null($currentPage)) {
            $currentPage = 1;
        }

        $collection = new Collection($item);
        $currentPageResults = $collection->slice(($currentPage - 1) * $perPage, $perPage)->all();

        if (!isset($options['path'])) {
            $options['path'] = $request->path();
        }

        return new Paginator(
            $currentPageResults, count($collection), $perPage, $currentPage, $options
        );
    }
174387
public function paginate($perPage)
    {
        if (\filter_var($perPage, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]) && ! \is_bool($perPage)) {
            $this->perPage = $perPage;
            $this->paginate = true;
        } elseif (\filter_var($perPage, FILTER_VALIDATE_BOOLEAN)) {
            $this->perPage = null;
            $this->paginate = $perPage;
        } else {
            $this->perPage = null;
            $this->paginate = false;
        }

        return $this;
    }
528212
public function addPage(\CampaignChain\Location\FacebookBundle\Entity\Page $pages)
    {
        $this->pages[] = $pages;

        return $this;
    }
678316
public function paginateRaw($count, $page, $itemsPerPage)
    {
        $this->paginator->tweak($count, $itemsPerPage, $page);
        $this->limit($this->paginator->countOffset(), $this->paginator->getItemsPerPage());

        return $this;
    }
988481
protected function createPagiList($page = 1, $anchor_content = 1, $disabled = false, $active =  false)
    {
        // generate classes
        $disabled_class = $disabled ? 'disabled' : NULL;
        $active_class   = $active ? 'active' : NULL;

        ?>
        <li class="<?php echo $disabled_class; ?> <?php echo $active_class ?>" >
            <a href="<?php echo $this->createUrl(array('page'=>$page)) ?>" data-page="<?php echo $page; ?>" >
                <?php echo $anchor_content ?>
            </a>
        </li>
    <?php
    }
285632
public function setPagination($page, $perPage)
    {
        $this->setParam('page', $page);
        $this->setParam('per_page', $perPage);

        return $this;
    }
440698
protected function SetActivePageSort()
    {
        $this->sActivePageSort = $this->GetUserInput('pagesort');
        if (empty($this->sActivePageSort)) {
            //load default
            $this->sActivePageSort = $this->GetPageSortDefaultValue(); //default
            $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort);
        } else {
            $bFound = false;
            foreach ($this->aPageSort as $iPsKey => $aPsVal) {
                if (in_array($this->sActivePageSort, $aPsVal)) {
                    $bFound = true;
                }
            }
            if (!$bFound) {
                //try to load from session
                $this->sActivePageSort = strtolower(trim($this->GetModuleSessionParameter('pagesort', false)));
                if (!$this->sActivePageSort) {
                    $this->sActivePageSort = $this->aPageSort[1]['id'];
                } //default
                $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort);
            }
        }
    }
196247
public function paginate($page, $itemsOnPage = 30)
    {
        $paginator = new Paginator($this);
        return $paginator
            ->setCurrentPage($page)
            ->setItemsOnPage($itemsOnPage);
    }
328343
protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
    {
        $elementsPerPage = (int)$elementsPerPage;
        $page = (int)$page;

        return $queryBuilder
            ->setMaxResults($elementsPerPage)
            ->setFirstResult($elementsPerPage * ($page - 1));
    }
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);
    }