/**
  * Get The Page ID
  * This gets the id of the page, checks if the page is in the domain and if the page is accessible
  * Sets variables such as $this->sys_page, $this->loginUser, $this->gr_list, $this->id, $this->type, $this->domainStartPage, $this->idParts
  *
  * @return	void
  * @access private
  */
 function fetch_the_id()
 {
     $GLOBALS['TT']->push('fetch_the_id initialize/', '');
     // Initialize the page-select functions.
     $this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
     $this->sys_page->versioningPreview = $this->fePreview === 2 || intval($this->workspacePreview) || t3lib_div::_GP('ADMCMD_view') ? TRUE : FALSE;
     $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
     $this->sys_page->init($this->showHiddenPage);
     // Set the valid usergroups for FE
     $this->initUserGroups();
     // Sets sys_page where-clause
     $this->setSysPageWhereClause();
     // Splitting $this->id by a period (.). First part is 'id' and second part - if exists - will overrule the &type param if given
     $pParts = explode('.', $this->id);
     $this->id = $pParts[0];
     // Set it.
     if (isset($pParts[1])) {
         $this->type = $pParts[1];
     }
     // Splitting $this->id by a comma (,). First part is 'id' and other parts are just stored for use in scripts.
     $this->idParts = explode(',', $this->id);
     // Splitting by a '+' sign - used for base64/md5 methods of parameter encryption for simulate static documents.
     list($pgID, $SSD_p) = explode('+', $this->idParts[0], 2);
     if ($SSD_p) {
         $this->idPartsAnalyze($SSD_p);
     }
     $this->id = $pgID;
     // Set id
     // If $this->id is a string, it's an alias
     $this->checkAndSetAlias();
     // The id and type is set to the integer-value - just to be sure...
     $this->id = intval($this->id);
     $this->type = intval($this->type);
     $GLOBALS['TT']->pull();
     // We find the first page belonging to the current domain
     $GLOBALS['TT']->push('fetch_the_id domain/', '');
     $this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']);
     // the page_id of the current domain
     if (!$this->id) {
         if ($this->domainStartPage) {
             $this->id = $this->domainStartPage;
             // If the id was not previously set, set it to the id of the domain.
         } else {
             $theFirstPage = $this->sys_page->getFirstWebPage($this->id);
             // Find the first 'visible' page in that domain
             if ($theFirstPage) {
                 $this->id = $theFirstPage['uid'];
             } else {
                 if ($this->checkPageUnavailableHandler()) {
                     $this->pageUnavailableAndExit('No pages are found on the rootlevel!');
                 } else {
                     $message = 'No pages are found on the rootlevel!';
                     t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
                     header('HTTP/1.0 503 Service Temporarily Unavailable');
                     $this->printError($message);
                     exit;
                 }
             }
         }
     }
     $GLOBALS['TT']->pull();
     $GLOBALS['TT']->push('fetch_the_id rootLine/', '');
     $requestedId = $this->id;
     // We store the originally requested id
     $this->getPageAndRootlineWithDomain($this->domainStartPage);
     $GLOBALS['TT']->pull();
     if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
         $pNotFoundMsg = array(1 => 'ID was not an accessible page', 2 => 'Subsection was found and not accessible', 3 => 'ID was outside the domain', 4 => 'The requested page alias does not exist');
         $this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
     }
     // set no_cache if set
     if ($this->page['no_cache']) {
         $this->set_no_cache();
     }
     // Init SYS_LASTCHANGED
     $this->register['SYS_LASTCHANGED'] = intval($this->page['tstamp']);
     if ($this->register['SYS_LASTCHANGED'] < intval($this->page['SYS_LASTCHANGED'])) {
         $this->register['SYS_LASTCHANGED'] = intval($this->page['SYS_LASTCHANGED']);
     }
 }