Makes sure that self::$pageForEnableFields is a page object.

@return void
186503
private static function retrievePageForEnableFields()
    {
        if (!is_object(self::$pageForEnableFields)) {
            if (isset($GLOBALS['TSFE'])
                && is_object($GLOBALS['TSFE']->sys_page)
            ) {
                self::$pageForEnableFields = $GLOBALS['TSFE']->sys_page;
            } else {
                self::$pageForEnableFields = GeneralUtility::makeInstance(PageRepository::class);
            }
        }
    }
1136731
protected function initCustomObjects()
    {
        $this->layoutObj = null;

        if (!$this->layout->isFallBack()) {
            CmsException::mask($this->layout, 300);
            $parser = new CodeParser($this->layout);
            $this->layoutObj = $parser->source($this->page, $this->layout, $this);
            CmsException::unmask();
        }

        CmsException::mask($this->page, 300);
        $parser = new CodeParser($this->page);
        $this->pageObj = $parser->source($this->page, $this->layout, $this);
        CmsException::unmask();
    }
624542
public function onBeforeWrite()
    {
        if (!$this->Original()->exists() && $this->Cropped()->exists()) {
            $this->Cropped()->delete();
        } elseif ($this->Original()->exists()) {
            $changes = $this->getChangedFields();

            if ($this->hasChanged($changes, 'ContainerX') ||
                $this->hasChanged($changes, 'ContainerY') ||
                $this->hasChanged($changes, 'ContainerWidth') ||
                $this->hasChanged($changes, 'ContainerHeight') ||
                $this->hasChanged($changes, 'CropperX') ||
                $this->hasChanged($changes, 'CropperY') ||
                $this->hasChanged($changes, 'CropperWidth') ||
                $this->hasChanged($changes, 'CropperHeight')) {
                    $this->doCrop = true;
            }
        }

        parent::onBeforeWrite();
    }
365002
public function initializeObject()
    {
        parent::initializeObject();

        $this->setPathsFromOptions();
        $this->setFormat('html');

        // Doesn't work without setting rendering context.
        // Even if StandaloneView works and we just extend it.
        $renderingContent = new RenderingContext;
        $renderingContent->setControllerContext($this->controllerContext);
        $this->setRenderingContext($renderingContent);
    }
1054823
protected function _prepareRendering()
    {
        $this->view->addDefaultViewParam('_template', $this);

        $structure = $this->getPageStructure();
        if (empty($structure)) {
            $this->setPageStructure(self::$default_page_structure);
        }
    }
16805
private function setPageEnd()
    {
        $lastPage = $this->currentPage + $this->numberLinks;

        if ($lastPage <= $this->nbPages) {
            $this->pageEnd = $lastPage;
        } else {
            $this->pageEnd = $this->nbPages;
        }
    }
1205667
private function setPagination()
    {
        // ALl Pages
        if ($this->perPage == 'all') return;

        $this->firstPage    = 1;
        $this->lastPage     = ceil($this->totalCount / $this->perPage);

        // if current page is greater than the total page
        // then set the current page equal to total page
        $this->page = min($this->page, $this->lastPage);

        // Calculate the offset of where the retrieval index start at
        $this->offset   = ($this->page - 1) * $this->perPage;
        $this->limit    = $this->perPage;

        // Next Page And Previous Page
        $this->nextPage = min($this->page + 1, $this->lastPage);
        $this->prevPage = max($this->page - 1, $this->firstPage);
    }
300751
public function makeFullpath(Page $page)
    {
        if ($page->getParent() === NULL)
        {
            $page->setFullpath('');
            $page->setSlug('');
        }
        else
        {
            $parentFullpath = $page->getParent()->getFullpath();
            $slug = $this->addSuffixNumber($page->getSlug(), $page);
            $page->setFullpath(($parentFullpath != '' ? ($parentFullpath . '/') : '') . $slug);
            $page->setSlug($slug);
            if ($page->hasChildren())
            {
                foreach ($page->getChildren() as $children)
                {
                    $this->makeFullpath($children);
                    $this->doctrine->getManager()->persist($children);
                }
            }
        }
    }
920494
protected function addPageName()
    {
        if (! empty($this->getPageName()) && ! in_array($this->getPageName(), $this->collection)) {
            $this->add($this->getPageName());
        }
    }
282458
protected function initTable(): void
    {
        $tableClass = class_namespace(static::class) . '\\Table';

        // check class initialization
        if (!class_exists($tableClass) || !is_subclass_of($tableClass, TableInterface::class)) {
            throw new TableNotFoundException('`Table` class is not exists or not initialized');
        }

        /**
         * @var TableInterface $tableClass
         */
        $this->setTable($tableClass::getInstance());
    }
346635
final public function page($pageNumber, $recordsPerPage = null)
    {
        $recordsPerPage = $recordsPerPage ?? $this->recordsPerPage;

        $this->getQuery()->limit(((int)$pageNumber) * $recordsPerPage, $recordsPerPage);
        $this->pagedQuery = true;

        return $this;
    }
218750
public function init()
    {
        $pages = $this->getModel()->getPages();

        // Check datas
        if (empty($pages)) {
            return;
        }

        global $admin_page_hooks;

        // Set the internal pointer of an array to its first element
        reset($pages);

        // Update identifier
        $identifier = Helpers::urlize(key($pages));
        $this->getModel()->setIdentifier($identifier);

        // Add root single menu if identifier is unknown
        if (!isset($admin_page_hooks[$identifier])) {
            $this->addRootPage();
        }

        // Iterate on pages
        foreach ($pages as $slug => $options) {
            if (empty($options)) {
                continue;
            }

            // Get slug
            $slug = Helpers::urlize($slug);

            // Add child menu
            $this->addChild($slug, $options);
        }
    }
1023819
def same_page_choosen(form, field):
    """"""
    if form._obj is not None:
        if field.data.id == form._obj.list_id:
            raise ValidationError(
                _('You cannot assign list page itself as a child.'))
452876
public function registerInFormIfPossible()
    {
        parent::registerInFormIfPossible();
        foreach ($this->renderables as $renderable) {
            if ($renderable instanceof AbstractRenderable) {
                $renderable->registerInFormIfPossible();
            }
        }
    }
417367
public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();

        // Only run on ErrorPage class directly, not subclasses
        if (static::class !== self::class || !SiteTree::config()->create_default_pages) {
            return;
        }

        $defaultPages = $this->getDefaultRecords();

        foreach ($defaultPages as $defaultData) {
            $this->requireDefaultRecordFixture($defaultData);
        }
    }
936600
public function index()
    {
        if($this->presenter->page->file instanceof SplFileInfo) {
            $this->view->page(presenter()->page->file->getRealPath());
        }
    }
997900
public function onBeforeWrite() {
		parent::onBeforeWrite();
		$slug = singleton('SiteTree')->generateURLSegment($this->Identifier);
		$original_slug = $slug;
		$i = 0;
		while($t = PermamailTemplate::get()
			->filter(array("Identifier" => "$slug"))
			->exclude(array("ID" => $this->ID))
			->first()
		) {	
			$i++;
			$slug = $original_slug."-{$i}";
		}
		$this->Identifier = $slug;

		$reflector = EmailReflectionTemplate::create();
		$reflector->process($this->Content);

		$vars = array ();
		foreach($reflector->getTopLevelVars() as $var => $type) {
			$vars[$var] = false;
		}
		foreach($reflector->getTopLevelBlocks() as $block) {
			$vars[$block->getName()] = $block->isLoop();
		}
		// Remove any variables that are no longer in the template
		if($this->TestVariables()->exists()) {
			$this->TestVariables()->exclude(array('Variable' => array_keys($vars)))->removeAll();
		}
		
		$currentVars = $this->TestVariables()->column('Variable');

		foreach($vars as $var => $isList) {
			if(!in_array($var, $currentVars)) {
				$v = PermamailTemplateVariable::create(array(
					'Variable' => $var,
					'PermamailTemplateID' => $this->ID,
					'List' => $isList
				));
				$v->write();
			}
		}
	}