/**
  * Set the pagename for the logfile entry
  *
  * @return	void
  * @access private
  */
 protected function statistics_init_pagename()
 {
     if (preg_match('/utf-?8/i', $this->config['config']['stat_apache_niceTitle'])) {
         // Make life easier and accept variants for utf-8
         $this->config['config']['stat_apache_niceTitle'] = 'utf-8';
     }
     if ($this->config['config']['stat_apache_niceTitle'] == 'utf-8') {
         $shortTitle = $this->csConvObj->utf8_encode($this->page['title'], $this->renderCharset);
     } elseif ($this->config['config']['stat_apache_niceTitle']) {
         $shortTitle = $this->csConvObj->specCharsToASCII($this->renderCharset, $this->page['title']);
     } else {
         $shortTitle = $this->page['title'];
     }
     $len = t3lib_div::intInRange($this->config['config']['stat_apache_pageLen'], 1, 100, 30);
     if ($this->config['config']['stat_apache_niceTitle'] == 'utf-8') {
         $shortTitle = rawurlencode($this->csConvObj->substr('utf-8', $shortTitle, 0, $len));
     } else {
         $shortTitle = substr(preg_replace('/[^.[:alnum:]_-]/', '_', $shortTitle), 0, $len);
     }
     $pageName = $this->config['config']['stat_apache_pagenames'] ? $this->config['config']['stat_apache_pagenames'] : '[path][title]--[uid].html';
     $pageName = str_replace('[title]', $shortTitle, $pageName);
     $pageName = str_replace('[uid]', $this->page['uid'], $pageName);
     $pageName = str_replace('[alias]', $this->page['alias'], $pageName);
     $pageName = str_replace('[type]', $this->type, $pageName);
     $pageName = str_replace('[request_uri]', t3lib_div::getIndpEnv('REQUEST_URI'), $pageName);
     $temp = $this->config['rootLine'];
     if ($temp) {
         // rootLine does not exist if this function is called at early stage (e.g. if DB connection failed)
         array_pop($temp);
         if ($this->config['config']['stat_apache_noRoot']) {
             array_shift($temp);
         }
         $len = t3lib_div::intInRange($this->config['config']['stat_titleLen'], 1, 100, 20);
         if ($this->config['config']['stat_apache_niceTitle'] == 'utf-8') {
             $path = '';
             $c = count($temp);
             for ($i = 0; $i < $c; $i++) {
                 if ($temp[$i]['uid']) {
                     $p = $this->csConvObj->crop('utf-8', $this->csConvObj->utf8_encode($temp[$i]['title'], $this->renderCharset), $len, "…");
                     // U+2026; HORIZONTAL ELLIPSIS
                     $path .= '/' . rawurlencode($p);
                 }
             }
         } elseif ($this->config['config']['stat_apache_niceTitle']) {
             $path = $this->csConvObj->specCharsToASCII($this->renderCharset, $this->sys_page->getPathFromRootline($temp, $len));
         } else {
             $path = $this->sys_page->getPathFromRootline($temp, $len);
         }
     } else {
         $path = '';
         // If rootLine is missing, we just drop the path...
     }
     if ($this->config['config']['stat_apache_niceTitle'] == 'utf-8') {
         $this->config['stat_vars']['pageName'] = str_replace('[path]', $path . '/', $pageName);
     } else {
         $this->config['stat_vars']['pageName'] = str_replace('[path]', preg_replace('/[^.[:alnum:]\\/_-]/', '_', $path . '/'), $pageName);
     }
 }
 /**
  * @test
  */
 public function getPathFromRootLineForEmptyRootLineReturnsEmptyString()
 {
     $this->assertEquals('', $this->pageSelectObject->getPathFromRootline(array()));
 }