/**
  * Checks if the page has a path to override.
  *
  * @param int $id
  * @param string $mpvar
  * @param int $lang
  * @return array
  */
 protected function IDtoPagePathThroughOverride($id, $mpvar, $lang)
 {
     $result = false;
     $page = $this->getPage($id, $lang);
     if ($page['tx_realurl_pathoverride']) {
         if ($page['tx_realurl_pathsegment']) {
             $result = array('pagepath' => trim($page['tx_realurl_pathsegment'], '/'), 'langID' => intval($lang), 'rootpage_id' => intval($this->conf['rootpage_id']));
         } else {
             $message = sprintf('Path override is set for page=%d (language=%d) but no segment defined!', $id, $lang);
             $this->apiWrapper->sysLog($message, 'realurl', 3);
             $this->pObj->devLog($message, false, 2);
         }
     }
     return $result;
 }
 /**
  * Fetches RealURl configuration for the given page
  *
  * @param int $pageId
  * @return void
  */
 protected function fetchRealURLConfiguration($pageId)
 {
     $rootLine = $this->apiWrapper->BEgetRootLine($pageId);
     $rootPageId = $rootLine[1]['uid'];
     $this->config = array();
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] as $config) {
             if (is_array($config) && $config['pagePath']['rootpage_id'] == $rootPageId) {
                 $this->config = $config;
                 return;
             }
         }
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'])) {
             $this->config = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];
         }
     } else {
         $this->apiWrapper->sysLog('RealURL is not configured! Please, configure it or uninstall.', 'RealURL', 3);
     }
 }