public function initializeFrontEndRendering($pageId = 0, $type = 0)
    {
        if (array_key_exists('TSFE', $GLOBALS) && is_object($GLOBALS['TSFE']->tmpl)) {
            // FE is already initialized - this can happen when we use/call internal REST-endpoints inside of a normal TYPO3-page
            $this->isFrontEndRenderingInitialized = true;
        }
        if ($this->isFrontEndRenderingInitialized === true) {
            return;
        }

        $GLOBALS['TT'] = new NullTimeTracker();

        if ($this->isFrontEndUserInitialized === false) {
            $this->initializeFrontEndUser($pageId, $type);
        }

        EidUtility::initTCA();

        $tsfe = $this->getTsfe($pageId, $type);
        $tsfe->determineId();
        $tsfe->initTemplate();
        $tsfe->getConfigArray();
        $tsfe->newCObj();
        $tsfe->calculateLinkVars();
        $this->isFrontEndRenderingInitialized = true;
    }