URL decode stats

john
2009-09-15
2012-10-11
  • john
    john
    2009-09-15

    My issue is as follows, I have one page:
    /downloads/More Text Here.zip

    Some stats show like so:
    /downloads/More%20Text%20Here.zip

    and others like so:
    /downloads/%5bText%5dMore%20Text%20Here.zip

    I was wondering if there was a way to tell awstats to url decode before
    compiling the stats (and to have it do so retroactively since my current stats
    are off) so that each download is recorded correctly.

     
  • Dmitry Katsubo
    Dmitry Katsubo
    2011-10-16

    I wonder about the same. Maybe I have missed the necessary configuration
    option...

     
  • Dmitry Katsubo
    Dmitry Katsubo
    2011-11-03

    For those who is interested, here goes the patch:

    --- awstats.pl.orig     2011-10-16 16:29:59.728857013 +0200
    +++ awstats.pl  2011-11-03 12:49:18.945971378 +0100
    @@ -18,6 +18,7 @@
       ; # use Time::Local 'timelocal_nocheck' is faster but not supported by all Time::Local modules
     use Socket;
     use Encode;
    +use URI::Escape; # Debian package: liburi-perl
    
     #------------------------------------------------------------------------------
     # Defines
    @@ -8790,7 +8791,7 @@
                                    print "<a href=\""
                                      . XMLEncode("$newkey")
                                      . "\" target=\"url\">"
    -                                 . XMLEncode($nompage) . "</a>";
    +                                 . XMLEncode(uri_unescape($nompage)) . "</a>";
                            }
                            elsif ( $newkey =~ /^\// )
                            { # URL seems to be an url extracted from a web or wap server log file
    @@ -8805,7 +8806,7 @@
                                    print "<a href=\""
                                      . XMLEncode("$urlprot://$SiteDomain$newkey")
                                      . "\" target=\"url\">"
    -                                 . XMLEncode($nompage) . "</a>";
    +                                 . XMLEncode(uri_unescape($nompage)) . "</a>";
                            }
                            else {
                                    print XMLEncode($nompage);