@param Page $page

@return string
772198
public function getPrefix(Page $page)
    {
        $parent = $page->getParent();

        if ($parent === null) {
            return '';
        }

        return ($parent->getChildPageUrlPrefix()) ?: $page->getParent()->url()->getLocation();
    }
978681
public function actionIndex($page = 1)
    {
        $sort = [];
        $params = Yii::$app->request->queryParams;
        if (empty($params['sort'])) {
            $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
        } else {
            if($params['sort'] == 'module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
                unset($params['sort']);
            } else if ($params['sort'] == '-module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_DESC, 'module_id' => SORT_DESC];
                unset($params['sort']);
            }
            Yii::$app->request->setQueryParams($params);
        }

        $dataProvider = new ActiveDataProvider([
            'query' => Modmgr::find(),
            'sort' => $sort,
        ]);

        $pager = $dataProvider->getPagination();
        $pager->pageSize = $this->pageSize;
        $pager->page = $page - 1; //! from 0

        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
810107
public function getDataForBreadcrumb(Page $page)
    {
        $parent = $page->getParent();
        if ($parent)
        {
            $data = array();
            if ($parent->getParent())
            {
                $data = array_merge($this->getDataForBreadcrumb($parent), $data);
            }
            $data[] = $parent;
            return $data;
        }
        return NULL;
    }
905010
protected function generatePageText($page)
	{
		if($this->pageTextFormat!==null)
			return sprintf($this->pageTextFormat,$page+1);
		else
			return $page+1;
	}
688775
private function generateAddUrl(array $page): string
    {
        $event = new GenerateFrontendUrlEvent($page, null, $page['language']);

        $this->dispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);

        $url = UrlBuilder::fromUrl($event->getUrl() . '?')
            ->setQueryParameter('act', 'create');

        return $url->getUrl();
    }
8094
protected function loadStaticPage($page)
    {
        $layout = $this->layout ?: $this;
        try {
            $t = 'page/'.str_replace('_', '/', strtolower($page));
            $this->template->findTemplate($t);

            $this->page_object = $layout->add($this->page_class, $page, 'Content', array($t));
        } catch (Exception_PathFinder $e2) {
            $t = 'page/'.strtolower($page);
            $this->template->findTemplate($t);
            $this->page_object = $layout->add($this->page_class, $page, 'Content', array($t));
        }

        return $this->page_object;
    }
16694
public function getText(Page $page = null)
    {
        $text                = '';
        $sections            = $this->getSectionsText($this->content);
        $current_font = null;

        foreach ($this->document->getObjects() as $obj) {
            if ($obj instanceof Font) {
                $current_font = $obj;
                break;
            }
        }

        if ($current_font === null) {
            $current_font = new Font($this->document);
        }

        $current_position_td = array('x' => false, 'y' => false);
        $current_position_tm = array('x' => false, 'y' => false);

        array_push(self::$recursionStack, $this->getUniqueId());

        foreach ($sections as $section) {

            $commands = $this->getCommandsText($section);

            foreach ($commands as $command) {

                switch ($command[self::OPERATOR]) {
                    // set character spacing
                    case 'Tc':
                        break;

                    // move text current point
                    case 'Td':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if ((floatval($x) <= 0) ||
                            ($current_position_td['y'] !== false && floatval($y) < floatval($current_position_td['y']))
                        ) {
                            // vertical offset
                            $text .= "\n";
                        } elseif ($current_position_td['x'] !== false && floatval($x) > floatval(
                                $current_position_td['x']
                            )
                        ) {
                            // horizontal offset
                            $text .= ' ';
                        }
                        $current_position_td = array('x' => $x, 'y' => $y);
                        break;

                    // move text current point and set leading
                    case 'TD':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if (floatval($y) < 0) {
                            $text .= "\n";
                        } elseif (floatval($x) <= 0) {
                            $text .= ' ';
                        }
                        break;

                    case 'Tf':
                        list($id,) = preg_split('/\s/s', $command[self::COMMAND]);
                        $id           = trim($id, '/');
                        if (!is_null($page)) {
                            $current_font = $page->getFont($id);
                        }
                        break;

                    case "'":
                    case 'Tj':
                        $command[self::COMMAND] = array($command);
                    case 'TJ':
                        // Skip if not previously defined, should never happened.
                        if (is_null($current_font)) {
                            // Fallback
                            // TODO : Improve
                            $text .= $command[self::COMMAND][0][self::COMMAND];
                            break;
                        }

                        $sub_text = $current_font->decodeText($command[self::COMMAND]);
                        $text .= $sub_text;
                        break;

                    // set leading
                    case 'TL':
                        $text .= ' ';
                        break;

                    case 'Tm':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if ($current_position_tm['x'] !== false) {
                            $delta = abs(floatval($x) - floatval($current_position_tm['x']));
                            if ($delta > 10) {
                                $text .= "\t";
                            }
                        }
                        if ($current_position_tm['y'] !== false) {
                            $delta = abs(floatval($y) - floatval($current_position_tm['y']));
                            if ($delta > 10) {
                                $text .= "\n";
                            }
                        }
                        $current_position_tm = array('x' => $x, 'y' => $y);
                        break;

                    // set super/subscripting text rise
                    case 'Ts':
                        break;

                    // set word spacing
                    case 'Tw':
                        break;

                    // set horizontal scaling
                    case 'Tz':
                        $text .= "\n";
                        break;

                    // move to start of next line
                    case 'T*':
                        $text .= "\n";
                        break;

                    case 'Da':
                        break;

                    case 'Do':
                        if (!is_null($page)) {
                            $args    = preg_split('/\s/s', $command[self::COMMAND]);
                            $id      = trim(array_pop($args), '/ ');
                            $xobject = $page->getXObject($id);


                             // @todo $xobject could be a ElementXRef object, which would then throw an error
                             if ( is_object($xobject) && $xobject instanceof PDFObject && !in_array($xobject->getUniqueId(), self::$recursionStack) ) {
                                // Not a circular reference.
                                $text .= $xobject->getText($page);
                            }
                        }
                        break;

                    case 'rg':
                    case 'RG':
                        break;

                    case 're':
                        break;

                    case 'co':
                        break;

                    case 'cs':
                        break;

                    case 'gs':
                        break;

                    case 'en':
                        break;

                    case 'sc':
                    case 'SC':
                        break;

                    case 'g':
                    case 'G':
                        break;

                    case 'V':
                        break;

                    case 'vo':
                    case 'Vo':
                        break;

                    default:
                }
            }
        }

        array_pop(self::$recursionStack);

        return $text . ' ';
    }
305295
public function needTranslatedPages(Page $page)
    {
       // Route page
       if (!$page->getParent() || !is_null($page->getSourceId()))
       {
            return FALSE;
       }
       if ($this->container->hasParameter('fulgurio_light_cms.languages'))
       {
            $availableLangs = $this->container->getParameter('fulgurio_light_cms.languages');
            $nbAvailableLangs = count($availableLangs);
            $availableTranslatedPages = $this->doctrine->getRepository('FulgurioLightCMSBundle:Page')->findBy(array('source_id' => $page->getId()), array('lang' => 'ASC'));
            $nbAvailableTranslatedPages = count($availableTranslatedPages);
            $availableTranslatedParents = $this->doctrine->getRepository('FulgurioLightCMSBundle:Page')->findBy(array('source_id' => $page->getParent()->getId()), array('lang' => 'ASC'));
            $nbAvailableTranslatedParents = count($availableTranslatedParents);
            // If we create a new page
            if ($page->getParent()->getMetaValue('is_home') == '1' && $nbAvailableLangs != $availableTranslatedPages)
            {
                $langs = array_flip($availableLangs);
                foreach ($availableTranslatedPages as $availableTranslatedPage)
                {
                    unset($langs[$availableTranslatedPage->getLang()]);
                }
                foreach ($langs as $lang => $value)
                {
                    if ($lang == $page->getLang())
                    {
                        unset($langs[$lang]);
                    }
                    else
                    {
                        $langs[$lang] = $page->getParent()->getId();
                    }
                }
                return $langs;
            }
            // Normal children page
            else if ($nbAvailableTranslatedPages != $nbAvailableTranslatedParents && $nbAvailableTranslatedParents < $nbAvailableLangs)
            {
                $langs = array_flip($availableLangs);
                foreach ($availableTranslatedPages as $availableTranslatedPage)
                {
                    unset($langs[$availableTranslatedPage->getLang()]);
                }
                foreach ($availableTranslatedParents as $availableTranslatedParent)
                {
                    if (isset($langs[$availableTranslatedParent->getLang()]))
                    {
                        $langs[$availableTranslatedParent->getLang()] = $availableTranslatedParent->getId();
                    }
                }
                foreach ($langs as $lang => $value)
                {
                    if (is_null($value) || $lang == $page->getLang())
                    {
                        unset($langs[$lang]);
                    }
                }
                return $langs;
            }
        }
        return FALSE;
    }
436936
private function findChildrenPages(Page $page)
    {
        $pages = Page::where('parent_id', $page->id)->orderBy('header_order')->get();

        return $pages;
    }
929310
static function PageMembergroups(Page $page)
    {
        if (!$page->Exists())
        {
            return array();
        }
        $sql = Access::SqlBuilder();
        $tblPmg = PageMembergroup::Schema()->Table();
        $tblMg = Membergroup::Schema()->Table();
        $join = $sql->Join($tblPmg);
        $joinCondition = $sql->Equals($tblPmg->Field('MemberGroup'), $tblMg->Field('ID'));
        $where = $sql->Equals($tblPmg->Field('Page'), $sql->Value($page->GetID()));
        $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name')));
        
        return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition);
    }
1291910
static function FindPageRights(Page $page)
    {
        $currPage = $page;
        $result = null;
        do 
        {
            $result = $currPage->GetUserGroupRights();
            $currPage = $currPage->GetParent();
        } 
        while (!$result && $currPage);
        if (!$result && $page->GetSite())
        {
            $siteRights = $page->GetSite()->GetUserGroupRights();
            if ($siteRights)
            {
                return $siteRights->GetPageRights();
            }
        }
        return $result;
    }
213109
public function page($page)
    {
        $limit = $this->getSqlPart('limit');
        if (!$limit) {
            $limit = 10;
            $this->add('limit', $limit);
        }
        return $this->offset(($page - 1) * $limit);
    }
727433
private function getPagination($page)
    {
        $limit = 5;
        if ($page !== null) {
            if ($page === 'all') {
                $limit = null;
                $page = null;
            } else {
                $page = (int) $page;
            }
        } else {
            $page = 1;
        }

        return ['page' => $page, 'limit' => $limit];
    }
289106
public function pageAction( $page = 1 )
    {
        $sitemap               = new DOMDocument( "1.0", "UTF-8" );
        $root                  = $sitemap->createElement( "urlset" );
        $sitemap->formatOutput = true;
        $root->setAttribute( "xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9" );
        $sitemap->appendChild( $root );
        $query         = $this->getQuery();
        $query->limit  = static::PACKET_MAX;
        $query->offset = static::PACKET_MAX * ( $page - 1 );

        $searchService = $this->get( "ezpublish.api.repository" )->getSearchService();

        $results = $searchService->findLocations( $query );
        $this->fillSitemap( $sitemap, $root, $results );

        $response = new Response( $sitemap->saveXML(), 200, [ "Content-type" => "text/xml" ] );
        $response->setSharedMaxAge( 24 * 3600 );

        return $response;
    }
803496
public function getPageUrl($page=NULL) {
	
		// save current order val
		$tmp = $this->page;
	
		// build url with order value in param
		$this->page = (int)$page;
		$url = $this->getUrl();
		$this->page = $tmp;
	
		return $url;
	
	}
165627
public function getTemplate(Page $page)
    {
        $this->authorize('editTemplate', $page);

        return view("$this->viewPrefix.template", [
            'current'   => $page->getTemplate(),
            'templates' => TemplateFacade::findValid(),
        ]);
    }
428054
public function resolve(Page $page = null)
    {
        if (null === $page || (null === $metadataBag = $page->getMetaData())) {
            $metadataBag = new MetaDataBag();
        }

        if (!is_array($this->definitions)) {
            return $metadataBag;
        }

        foreach ($this->definitions as $name => $definition) {
            if (!is_array($definition)) {
                continue;
            }

            if (null === $metadata = $metadataBag->get($name)) {
                $metadata = new MetaData($name);
                $metadataBag->add($metadata);
            }

            $this->parseDefinition($definition, $metadata, $page);
        }

        return clone $metadataBag;
    }