@param $page

@return mixed
@throws \Doctrine\ORM\NonUniqueResultException
322620
protected function buildRevisionsNav(&$page)
    {
        if (empty($page['rcmIncludeRevisions'])) {
            return $page;
        }

        if (empty($page['pages'])) {
            $page['pages'] = [];
        }

        foreach ($page['rcmIncludeRevisions'] as $config) {
            $published = (bool)$config['published'];
            $limit = (int)$config['limit'];

            $revisions = $this->getRevisionList($published, $limit);

            if (empty($revisions['revisions'])) {
                continue;
            }

            foreach ($revisions['revisions'] as $revision) {
                $pageConfig = $config['page'];

                array_walk_recursive(
                    $pageConfig,
                    [
                        $this,
                        'parseRevisionConfigValue'
                    ],
                    $revision
                );

                $page['pages'][] = $pageConfig;
            }
        }

        return $page;
    }
1231598
public function getMyNumPage($page = null)
    {
        if ($page === null) {
            $page = $this->page;
        }

        if ($this->_myLastPageGroupNb == 0) {
            return $page;
        } else {
            return $page-$this->_myLastPageGroup;
        }
    }
1056929
public function toTrash(Page $page)
    {
        $page->setState(Page::STATE_DELETED);

        if (!$page->isLeaf()) {
            $subquery = $this->getEntityManager()
                    ->getRepository('BackBee\NestedNode\Section')
                    ->createQueryBuilder('n')
                    ->select('n._uid')
                    ->andIsDescendantOf($page->getSection());

            $this->createQueryBuilder('p')
                            ->update()
                            ->set('p._state', Page::STATE_DELETED)
                            ->andWhere('p._section IN ('.$subquery->getDQL().')')
                            ->setParameters($subquery->getParameters())
                            ->getQuery()
                            ->execute();
        }

        return $page;
    }
1072811
public function index($page = null)
    {
        $url = sprintf('buckets/%d/questions/%d/answers.json', $this->bucket, $this->parent);

        $answers = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($answers, QuestionAnswer::class);
    }
1222909
public function getAll($page = null)
    {
        $page = !empty($page) ? "page={$page}" : '';
        $request = $this->paystackHttpClient->get(
            $this->transformUrl(Resource::CUSTOMERS_URL, '').$page
        );

        return $this->processResourceRequestResponse($request);
    }
165627
public function getTemplate(Page $page)
    {
        $this->authorize('editTemplate', $page);

        return view("$this->viewPrefix.template", [
            'current'   => $page->getTemplate(),
            'templates' => TemplateFacade::findValid(),
        ]);
    }
1362882
public function getPage($page = false)
    {
        $this->setCurrentPage($page);
        $offset = 0;
        if ($this->currentPage > 1) {
            $offset = min($this->itemsPerPage * ($this->currentPage - 1), 2147483647);
        }

        return $this->get($this->itemsPerPage, $offset);
    }
356165
public function findOrCreateFor(HasPageTemplateInterface $page)
    {
        $pageTemplateConfiguration = $this->repo->findFor($page);

        if (null === $pageTemplateConfiguration) {
            $pageTemplates = $this->reader->getPageTemplates($page);
            $names = array_keys($pageTemplates);
            $defaultPageTemplate = $pageTemplates[$names[0]];

            $pageTemplateConfiguration = new PageTemplateConfiguration();
            $pageTemplateConfiguration->setPageId($page->getId());
            $pageTemplateConfiguration->setPageEntityName(ClassLookup::getClass($page));
            $pageTemplateConfiguration->setPageTemplate($defaultPageTemplate->getName());
        }

        return $pageTemplateConfiguration;
    }
737202
public function page(int $page)
    {
        $this->query = array_merge($this->query ?? [], ['page' => $page]);

        return $this;
    }
1236857
public function getPage($page = 1, $limit = 10)
    {
        $options = [
            'builder' => $this,
            'limit'   => $limit,
            'page'    => $page,
        ];

        return $this->getDI()->get(Paginator::class, [$options]);
    }
1133915
protected function loadPage($page)
    {
        $this->pageStart = $page * $this->pageSize;
        $this->pageData = $this->query->setFirstResult($this->pageStart)->setMaxResults($this->pageSize)->getResult();
    }
948376
public function setPage($page)
    {
        if (empty($page)) {
            return $this->clearPage();
        }

        session()->put($this->getSessionKey(static::TYPE_PAGE), $page);

        return $this;
    }
840693
public function getUrl($page)
    {
        $request = Craft::$app->getRequest();

        // Get the query string params without the path or `pattern`
        parse_str($request->getQueryString(), $params);
        $pathParam = Craft::$app->getConfig()->getGeneral()->pathParam;
        unset($params[$pathParam], $params['pattern']);

        // Return the URL with the page param
        $params[$this->pageParam] = $page;
        return UrlHelper::url($request->getPathInfo(), $params);
    }
574813
public function url($page)
    {
        if ($page <= 0) {
            $page = 1;
        }

        // If we have any extra query string key / value pairs that need to be added
        // onto the URL, we will put them in query string form and then attach it
        // to the URL. This allows for extra information like sortings storage.
        $parameters = [$this->pageName => $page];

        if (count($this->query) > 0) {
            $parameters = array_merge($this->query, $parameters);
        }

        $uri = Uri::createFromString($this->path);

        parse_str($uri->getQuery(), $queryParts);

        return $uri->withQuery(http_build_query($parameters + $queryParts))
            ->withFragment($this->buildFragment())
            ->__toString();
    }
1166684
public function retrievePageElements($entityName, $page)
    {
        $page = $page < 1 ? 1 : $page;

        $qb = $this->createQueryBuilder($entityName);
        $qb
            ->setMaxResults($this->itemPerPage)
            ->setFirstResult(($page-1) * $this->itemPerPage)
        ;

        $paginator = new Paginator($qb, true);

        $this->page = $page;
        $this->count = $paginator->count();
        $this->results = $paginator->getIterator();
        $this->maxPage = ceil($this->count / $this->itemPerPage);

        return $this;
    }
545722
protected function getPagePriority(Page $page)
    {
        $result = '';
        $ak = $this->getSitemapPriorityAttributeKey();
        if ($ak !== null) {
            $result = (string) $page->getAttribute($ak);
        }
        if ($result === '') {
            $result = $this->getDefaultPriority();
        }

        return $result;
    }
225215
public function paginate($page, $limit)
    {
        if (!$this->getModelClass()) {
            throw new ModelNotFoundException('setModelClass');
        }

        /** @var EntityRepository $repository */
        $repository = $this->getManager()->getRepository($this->getModelClass());
        $queryBuilder = $repository->createQueryBuilder(Constants::MODEL_ALIAS);

        $filterList = new FilterQueryEvent();
        $filterList->setQueryBuilder($queryBuilder);
        $filterList->setAlias(Constants::MODEL_ALIAS);
        $filterList->setModelClass($this->getModelClass());

        $this->getEventSubscriber()->subscribe(Constants::FILTER_LIST, $filterList);

        $query = $filterList->getQueryBuilder()->getQuery();
        $query->useQueryCache(true);
        $query->useResultCache(true, $this->cacheLifetime, sprintf('%s_%s', $this->getModelClass(), serialize($query->getParameters()->toArray())));

        return $this->getPaginator()->paginate($query, $page, $limit);
    }