Nice filenames in Apache stat files
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Tue, 4 Oct 2005 10:26:43 +0000 (10:26 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Tue, 4 Oct 2005 10:26:43 +0000 (10:26 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@807 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_fe.php

index 22d46c2..53c2478 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+
+2005-10-04 Martin Kutschker <martin.t.kutschker@blackbox.net>
+
+       * Fixed bug #1152: allow for nice filenames in Apache stat file (config.stat_apache_niceTitle)
+       * optionally remove the site root from the Apache stat file path (config.stat_apache_noRoot)
+
 2005-10-02 Bernhard Kraft  <kraftb@kraftb.at>
 
        * Integrated content-slide extension into core
@@ -6,7 +12,7 @@
 
 2005-09-19 Martin Kutschker <martin.t.kutschker@blackbox.net>
 
-       *  Fixed bug #1287: Detect Opera as Netscape3 (making image roll-overs work)
+       * Fixed bug #1287: Detect Opera as Netscape3 (making image roll-overs work)
 
 2005-09-18 Michael Stucki <michael@typo3.org>
 
index f0d89ac..b9ea57b 100755 (executable)
         * @return      void
         */
        function getConfigArray()       {
+               $setStatPageName = false;
+
                if (!is_array($this->config) || is_array($this->config['INTincScript']) || $this->forceTemplateParsing) {       // If config is not set by the cache (which would be a major mistake somewhere) OR if INTincScripts-include-scripts have been registered, then we must parse the template in order to get it
                                $GLOBALS['TT']->push('Parse template','');
 
                                        if ($this->config['config']['stat_apache'] && $this->config['config']['stat_apache_logfile'] && !strstr($this->config['config']['stat_apache_logfile'],'/'))    {
                                                if(t3lib_div::isAllowedAbsPath($theLogFile) && @is_file($theLogFile) && @is_writable($theLogFile))      {
                                                        $this->config['stat_vars']['logFile'] = $theLogFile;
-                                                       $shortTitle = substr(ereg_replace('[^\.[:alnum:]_-]','_',$this->page['title']),0,30);
-                                                       $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->page['type'],$pageName);
-                                                       $temp = $this->config['rootLine'];
-                                                       array_pop($temp);
-                                                       $len = t3lib_div::intInRange($this->config['config']['stat_titleLen'],1,100,20);
-                                                       $pageName = str_replace('[path]', ereg_replace('[^\.[:alnum:]\/_-]','_',$this->sys_page->getPathFromRootline($temp,$len)).'/' ,$pageName);
-                                                       $this->config['stat_vars']['pageName'] = $pageName;
+
+                                                               // set page name later on
+                                                       $setStatPageName = true;
                                                } else {
                                                        $GLOBALS['TT']->setTSlogMessage('Could not set logfile path. Check filepath and permissions.',3);
                                                }
                        // Initialize charset settings etc.
                $this->initLLvars();
 
+                       // We want nice names, so we need to know the charset
+               if ($setStatPageName)   {
+                       if ($this->config['config']['stat_apache_niceTitle'])   {
+                               $shortTitle = $this->csConvObj->specCharsToASCII($this->renderCharset,$this->page['title']);
+                       } else {
+                               $shortTitle = $this->page['title'];
+                       }
+                       $shortTitle = substr(preg_replace('/[^.[:alnum:]_-]/','_',$shortTitle),0,30);
+                       $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->page['type'],$pageName);
+                       $temp = $this->config['rootLine'];
+                       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);
+                       $pageName = str_replace('[path]', preg_replace('/[^.[:alnum:]\/_-]/','_',$this->sys_page->getPathFromRootline($temp,$len)).'/' ,$pageName);
+                       $this->config['stat_vars']['pageName'] = $pageName;
+               }
+
                        // No cache
                if ($this->config['config']['no_cache'])        { $this->set_no_cache(); }              // Set $this->no_cache true if the config.no_cache value is set!