~ubuntu-branches/ubuntu/saucy/awstats/saucy

« back to all changes in this revision

Viewing changes to wwwroot/cgi-bin/awstats.pl

  • Committer: Package Import Robot
  • Author(s): Sergey B Kirpichev
  • Date: 2013-02-22 19:33:53 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130222193353-kxadnnphaxmxlpp4
Tags: 7.1~dfsg-1
* Ensure that backwards compatible Java bytecode is built (Closes:
  #687414)
* Add option to easy switch off awstats crontabs.  Install symlink for
  awstats binary to /usr/bin.  Closes: #641481.
* Drop deprecated DMUA flag
* Link missing mime-icons to notavailable.png (Closes: #690379)
* Fix lintian unused-license-paragraph-in-dep5-copyright (Add comment
  for Files: wwwroot/icon/mime/*)
* Fix lintian copyright-refers-to-symlink-license (GPL -> GPL-1+)
* Install manpage
* Imported Upstream version 7.1~dfsg
* Update patches for new release
* Fix executable bit on awstats.pl
* Bump up Standards-Version (to 3.9.4)
* Change license for wwwroot/icon/mime/* icons (Closes: #698921)
* Update watch file for 7.x
* Add debian/icons/firefox.png to include-binaries
* Update DEB_UPSTREAM_TARBALL* stuff in rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# necessary from your scheduler to update your statistics and from command
6
6
# line or a browser to read report results.
7
7
# See AWStats documentation (in docs/ directory) for all setup instructions.
 
8
#
 
9
# This program is free software; you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation; either version 2 of the License, or
 
12
# (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
8
20
#------------------------------------------------------------------------------
9
 
# $Revision: 1.971 $ - $Author: eldy $ - $Date: 2010/10/16 17:24:03 $
 
21
# $Revision: 1.982 $ - $Author: eldy $ - $Date: 2012/10/24 22:33:50 $
10
22
require 5.007;
11
23
 
12
24
#$|=1;
23
35
# Defines
24
36
#------------------------------------------------------------------------------
25
37
use vars qw/ $REVISION $VERSION /;
26
 
$REVISION = '$Revision: 1.971 $';
 
38
$REVISION = '$Revision: 1.982 $';
27
39
$REVISION =~ /\s(.*)\s/;
28
40
$REVISION = $1;
29
 
$VERSION  = "7.0 (build $REVISION)";
 
41
$VERSION  = "7.1 (build $REVISION)";
30
42
 
31
43
# ----- Constants -----
32
44
use vars qw/
298
310
  $AllowAccessFromWebToFollowingIPAddresses $HTMLHeadSection $HTMLEndSection $LinksToWhoIs $LinksToIPWhoIs
299
311
  $LogFile $LogType $LogFormat $LogSeparator $Logo $LogoLink $StyleSheet $WrapperScript $SiteDomain
300
312
  $UseHTTPSLinkForUrl $URLQuerySeparators $URLWithAnchor $ErrorMessages $ShowFlagLinks
 
313
  $AddLinkToExternalCGIWrapper
301
314
  /;
302
315
(
303
316
        $DirLock,                                  $DirCgi,
313
326
        $WrapperScript,                            $SiteDomain,
314
327
        $UseHTTPSLinkForUrl,                       $URLQuerySeparators,
315
328
        $URLWithAnchor,                            $ErrorMessages,
316
 
        $ShowFlagLinks
 
329
        $ShowFlagLinks,                            $AddLinkToExternalCGIWrapper
317
330
  )
318
331
  = (
319
332
        '', '', '', '', '', '', '', '', '', '', '', '', '', '',
320
 
        '', '', '', '', '', '', '', '', '', '', '', '', ''
 
333
        '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''
321
334
  );
322
335
use vars qw/
323
336
  $color_Background $color_TableBG $color_TableBGRowTitle
511
524
  %MonthUnique %MonthVisits
512
525
  %MonthPages %MonthHits %MonthBytes
513
526
  %MonthNotViewedPages %MonthNotViewedHits %MonthNotViewedBytes
514
 
  %_session %_browser_h
 
527
  %_session %_browser_h %_browser_p
515
528
  %_domener_p %_domener_h %_domener_k %_errors_h %_errors_k
516
529
  %_filetypes_h %_filetypes_k %_filetypes_gz_in %_filetypes_gz_out
517
530
  %_host_p %_host_h %_host_k %_host_l %_host_s %_host_u
518
531
  %_waithost_e %_waithost_l %_waithost_s %_waithost_u
519
 
  %_keyphrases %_keywords %_os_h %_pagesrefs_p %_pagesrefs_h %_robot_h %_robot_k %_robot_l %_robot_r
 
532
  %_keyphrases %_keywords %_os_h %_os_p %_pagesrefs_p %_pagesrefs_h %_robot_h %_robot_k %_robot_l %_robot_r
520
533
  %_worm_h %_worm_k %_worm_l %_login_h %_login_p %_login_k %_login_l %_screensize_h
521
534
  %_misc_p %_misc_h %_misc_k
522
535
  %_cluster_p %_cluster_h %_cluster_k
725
738
        'Konqueror versions',
726
739
        ',',
727
740
        'Downloads',
 
741
        'Export CSV'
728
742
);
729
743
 
730
744
#------------------------------------------------------------------------------
825
839
 
826
840
                # Affiche tag meta generator
827
841
                print
828
 
"<meta name=\"generator\" content=\"AWStats $VERSION from config file awstats.$SiteConfig.conf (http://awstats.sourceforge.net)\"$endtag\n";
 
842
"<meta name=\"generator\" content=\"AWStats $VERSION from config file awstats.$SiteConfig.conf (http://www.awstats.org)\"$endtag\n";
829
843
 
830
844
                # Affiche tag meta robots
831
845
                if ($MetaRobot) {
986
1000
                        print
987
1001
"<span dir=\"ltr\" style=\"font: 11px verdana, arial, helvetica; color: #$color_text;\">";
988
1002
                        print
989
 
"<b>Advanced Web Statistics $VERSION</b> - <a href=\"http://awstats.sourceforge.net\" target=\"awstatshome\">";
 
1003
"<b>Advanced Web Statistics $VERSION</b> - <a href=\"http://www.awstats.org\" target=\"awstatshome\">";
990
1004
                        print $Message[169] . " $PROG";
991
1005
                        if ($listplugins) {
992
1006
                                my $atleastoneplugin = 0;
1329
1343
}
1330
1344
 
1331
1345
#------------------------------------------------------------------------------
1332
 
# Function:     Optimize an array removing duplicate entries
 
1346
# Function:     Optimize an array of precompiled regex by removing duplicate entries
1333
1347
# Parameters:   @Array notcasesensitive=0|1
1334
1348
# Input:        None
1335
1349
# Output:               None
1337
1351
#------------------------------------------------------------------------------
1338
1352
sub OptimizeArray {
1339
1353
        my $array = shift;
1340
 
        my @arrayunreg = map {
1341
 
                if (/\(\?[-^\w]*:(.*)\)/) { $1 }
1342
 
        } @$array;
 
1354
        my @arrayunreg = map { UnCompileRegex($_) } @$array;
1343
1355
        my $notcasesensitive = shift;
1344
1356
        my $searchlist       = 0;
1345
1357
        if ($Debug) {
1905
1917
                        $SiteDomain = $value;
1906
1918
                        next;
1907
1919
                }
 
1920
                if ( $param =~ /^AddLinkToExternalCGIWrapper/ ) {
 
1921
 
 
1922
                        # No regex test as AddLinkToExternalCGIWrapper is always exact value
 
1923
                        $AddLinkToExternalCGIWrapper = $value;
 
1924
                        next;
 
1925
        }
1908
1926
                if ( $param =~ /^HostAliases/ ) {
1909
1927
                        @HostAliases = ();
1910
1928
                        foreach my $elem ( split( /\s+/, $value ) ) {
2767
2785
        }
2768
2786
        if ( $ShowLinksToWhoIs !~ /[01]/ ) { $ShowLinksToWhoIs = 0; }
2769
2787
        $Logo     ||= 'awstats_logo6.png';
2770
 
        $LogoLink ||= 'http://awstats.sourceforge.net';
 
2788
        $LogoLink ||= 'http://www.awstats.org';
2771
2789
        if ( $BarWidth !~ /^\d+/  || $BarWidth < 1 )  { $BarWidth  = 260; }
2772
2790
        if ( $BarHeight !~ /^\d+/ || $BarHeight < 1 ) { $BarHeight = 90; }
2773
2791
        $color_Background =~ s/#//g;
3636
3654
                binmode HISTORYTMP;
3637
3655
                if ($xml) {
3638
3656
                        print HISTORYTMP
3639
 
'<xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://awstats.sourceforge.net/files/awstats.xsd">'
 
3657
'<xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.awstats.org/files/awstats.xsd">'
3640
3658
                          . "\n\n";
3641
3659
                }
3642
3660
                Save_History( "header", $year, $month, $date );
4615
4633
                                                        $countloaded++;
4616
4634
                                                        if ( $field[1] ) {
4617
4635
                                                                $_os_h{ $field[0] } += $field[1];
 
4636
                                                                $_os_p{ $field[0] } += $field[2];
4618
4637
                                                        }
4619
4638
                                                }
4620
4639
                                        }
4643
4662
                                if ( $SectionsToSave{'os'} ) {
4644
4663
                                        Save_History( 'os', $year, $month, $date );
4645
4664
                                        delete $SectionsToSave{'os'};
4646
 
                                        if ($withpurge) { %_os_h = (); }
 
4665
                                        if ($withpurge) { %_os_h = (); %_os_p = (); }
4647
4666
                                }
4648
4667
                                if ( !scalar %SectionsToLoad ) {
4649
4668
                                        debug(" Stop reading history file. Got all we need.");
4665
4684
                                                        $countloaded++;
4666
4685
                                                        if ( $field[1] ) {
4667
4686
                                                                $_browser_h{ $field[0] } += $field[1];
 
4687
                                                                $_browser_p{ $field[0] } += $field[2];
4668
4688
                                                        }
4669
4689
                                                }
4670
4690
                                        }
4695
4715
                                if ( $SectionsToSave{'browser'} ) {
4696
4716
                                        Save_History( 'browser', $year, $month, $date );
4697
4717
                                        delete $SectionsToSave{'browser'};
4698
 
                                        if ($withpurge) { %_browser_h = (); }
 
4718
                                        if ($withpurge) { %_browser_h = (); %_browser_p = (); }
4699
4719
                                }
4700
4720
                                if ( !scalar %SectionsToLoad ) {
4701
4721
                                        debug(" Stop reading history file. Got all we need.");
6896
6916
                }
6897
6917
                print HISTORYTMP "# OS ID - Hits\n";
6898
6918
                $ValueInFile{$sectiontosave} = tell HISTORYTMP;
6899
 
                print HISTORYTMP "${xmlbb}BEGIN_OS${xmlbs}"
 
6919
                print HISTORYTMP "${xmlbb}BEGIN_OS ID - Hits - Pages${xmlbs}"
6900
6920
                  . ( scalar keys %_os_h )
6901
6921
                  . "${xmlbe}\n";
6902
6922
                foreach ( keys %_os_h ) {
6903
 
                        print HISTORYTMP "${xmlrb}$_${xmlrs}$_os_h{$_}${xmlre}\n";
 
6923
                        my $hits        = $_os_h{$_}      || 0;
 
6924
                        my $pages       = $_os_p{$_}      || 0;
 
6925
                        print HISTORYTMP "${xmlrb}$_${xmlrs}$hits${xmlrs}$pages${xmlre}\n";
6904
6926
                }
6905
6927
                print HISTORYTMP "${xmleb}END_OS${xmlee}\n";
6906
6928
        }
6909
6931
                if ($xml) {
6910
6932
                        print HISTORYTMP "<section id='$sectiontosave'><comment>\n";
6911
6933
                }
6912
 
                print HISTORYTMP "# Browser ID - Hits\n";
 
6934
                print HISTORYTMP "# Browser ID - Hits - Pages\n";
6913
6935
                $ValueInFile{$sectiontosave} = tell HISTORYTMP;
6914
6936
                print HISTORYTMP "${xmlbb}BEGIN_BROWSER${xmlbs}"
6915
6937
                  . ( scalar keys %_browser_h )
6916
6938
                  . "${xmlbe}\n";
6917
6939
                foreach ( keys %_browser_h ) {
6918
 
                        print HISTORYTMP "${xmlrb}$_${xmlrs}$_browser_h{$_}${xmlre}\n";
 
6940
                        my $hits        = $_browser_h{$_}      || 0;
 
6941
                        my $pages       = $_browser_p{$_}      || 0;
 
6942
                        print HISTORYTMP "${xmlrb}$_${xmlrs}$hits${xmlrs}$pages${xmlre}\n";
6919
6943
                }
6920
6944
                print HISTORYTMP "${xmleb}END_BROWSER${xmlee}\n";
6921
6945
        }
7655
7679
        }
7656
7680
 
7657
7681
        # Reset all hash arrays with name beginning by _
7658
 
        %_session     = %_browser_h   = ();
 
7682
        %_session     = %_browser_h   = %_browser_p   = ();
7659
7683
        %_domener_p   = %_domener_h   = %_domener_k = %_errors_h = %_errors_k = ();
7660
7684
        %_filetypes_h = %_filetypes_k = %_filetypes_gz_in = %_filetypes_gz_out = ();
7661
7685
        %_host_p = %_host_h = %_host_k = %_host_l = %_host_s = %_host_u = ();
7662
7686
        %_waithost_e = %_waithost_l = %_waithost_s = %_waithost_u = ();
7663
 
        %_keyphrases = %_keywords   = %_os_h = %_pagesrefs_p = %_pagesrefs_h =
 
7687
        %_keyphrases = %_keywords   = %_os_h = %_os_p = %_pagesrefs_p = %_pagesrefs_h =
7664
7688
          %_robot_h  = %_robot_k    = %_robot_l = %_robot_r = ();
7665
7689
        %_worm_h = %_worm_k = %_worm_l = %_login_p = %_login_h = %_login_k =
7666
7690
          %_login_l      = %_screensize_h   = ();
7786
7810
}
7787
7811
 
7788
7812
#------------------------------------------------------------------------------
7789
 
# Function:     Decode an precompiled regex value to a common regex value
 
7813
# Function:     Decode a precompiled regex value to a common regex value
7790
7814
# Parameters:   compiledregextodecode
7791
7815
# Input:        None
7792
7816
# Output:       None
7793
7817
# Return:               standardregex
7794
7818
#------------------------------------------------------------------------------
7795
7819
sub UnCompileRegex {
7796
 
        shift =~ /\(\?[-^\w]*:(.*)\)/;
 
7820
        shift =~ /\(\?[-\w]*:(.*)\)/;
7797
7821
        return $1;
7798
7822
}
7799
7823
 
8439
8463
                'browsers',       'domains', 'operating_systems', 'robots',
8440
8464
                'search_engines', 'worms'
8441
8465
        );
8442
 
        print "----- $PROG $VERSION (c) 2000-2010 Laurent Destailleur -----\n";
 
8466
        print "----- $PROG $VERSION (c) 2000-2012 Laurent Destailleur -----\n";
8443
8467
        print
8444
8468
"AWStats is a free web server logfile analyzer to show you advanced web\n";
8445
8469
        print "statistics.\n";
8589
8613
        print "  Dynamic or static HTML or XHTML reports, static PDF reports\n";
8590
8614
        print "  Indexed text or XML monthly database\n";
8591
8615
        print "  And a lot of other advanced features and options...\n";
8592
 
        print "New versions and FAQ at http://awstats.sourceforge.net\n";
 
8616
        print "New versions and FAQ at http://www.awstats.org\n";
8593
8617
}
8594
8618
 
8595
8619
#------------------------------------------------------------------------------
8771
8795
                        {    # URL seems to be extracted from a proxy log file
8772
8796
                                print "<a href=\""
8773
8797
                                  . XMLEncode("$newkey")
8774
 
                                  . "\" target=\"url\">"
 
8798
                                  . "\" target=\"url\" rel=\"nofollow\">"
8775
8799
                                  . XMLEncode($nompage) . "</a>";
8776
8800
                        }
8777
8801
                        elsif ( $newkey =~ /^\// )
8786
8810
                                }
8787
8811
                                print "<a href=\""
8788
8812
                                  . XMLEncode("$urlprot://$SiteDomain$newkey")
8789
 
                                  . "\" target=\"url\">"
 
8813
                                  . "\" target=\"url\" rel=\"nofollow\">"
8790
8814
                                  . XMLEncode($nompage) . "</a>";
8791
8815
                        }
8792
8816
                        else {
9765
9789
 
9766
9790
                # Logo and flags
9767
9791
                if ( $FrameName ne 'mainleft' ) {
9768
 
                        if ( $LogoLink =~ "http://awstats.sourceforge.net" ) {
 
9792
                        if ( $LogoLink =~ "http://www.awstats.org" ) {
9769
9793
                                print "<td align=\"right\" rowspan=\"3\"><a href=\""
9770
9794
                                  . XMLEncode($LogoLink)
9771
9795
                                  . "\" target=\"awstatshome\"><img src=\"$DirIcons/other/$Logo\" border=\"0\""
9829
9853
 
9830
9854
                # Logo and flags
9831
9855
                if ( $FrameName eq 'mainright' ) {
9832
 
                        if ( $LogoLink =~ "http://awstats.sourceforge.net" ) {
 
9856
                        if ( $LogoLink =~ "http://www.awstats.org" ) {
9833
9857
                                print "<td align=\"right\" rowspan=\"2\"><a href=\""
9834
9858
                                  . XMLEncode($LogoLink)
9835
9859
                                  . "\" target=\"awstatshome\"><img src=\"$DirIcons/other/$Logo\" border=\"0\""
9927
9951
                print "</table>\n";
9928
9952
        }
9929
9953
 
9930
 
        if ( $FrameName ne 'mainleft' ) { print "</form>\n"; }
 
9954
        if ( $FrameName ne 'mainleft' ) { print "</form><br />\n"; }
9931
9955
        else { print "<br />\n"; }
9932
9956
        print "\n";
9933
9957
}
10407
10431
#------------------------------------------------------------------------------
10408
10432
# Function:     Prints the File Type table
10409
10433
# Parameters:   _
10410
 
# Input:        _
 
10434
# Input:        $NewLinkParams, $NewLinkTargets
10411
10435
# Output:       HTML
10412
10436
# Return:       -
10413
10437
#------------------------------------------------------------------------------
10414
10438
sub HTMLMainFileType{
 
10439
    my $NewLinkParams = shift;
 
10440
    my $NewLinkTarget = shift;
10415
10441
        if (!$LevelForFileTypesDetection > 0){return;}
10416
10442
        if ($Debug) { debug( "ShowFileTypesStatsCompressionStats", 2 ); }
10417
10443
        print "$Center<a name=\"filetypes\">&nbsp;</a><br />\n";
10420
10446
        my $Totalk = 0;
10421
10447
        foreach ( keys %_filetypes_k ) { $Totalk += $_filetypes_k{$_}; }
10422
10448
        my $title = "$Message[73]";
 
10449
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
10450
        # extend the title to include the added link 
 
10451
        $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
10452
           "$AddLinkToExternalCGIWrapper" . "?section=FILETYPES&baseName=$DirData/$PROG"
 
10453
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
10454
           . "&siteConfig=$SiteConfig" )
 
10455
           . "\"$NewLinkTarget>$Message[179]</a>");
 
10456
    } 
 
10457
 
10423
10458
        if ( $ShowFileTypesStats =~ /C/i ) { $title .= " - $Message[98]"; }
10424
10459
        
10425
10460
        # build keylist at top
10585
10620
        print
10586
10621
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th colspan=\"2\">$Message[58]</th>";
10587
10622
        print
10588
 
"<th width=\"80\">$Message[111]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th>";
 
10623
"<th width=\"80\">$Message[111]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[56]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[15]</th>";
 
10624
        print
 
10625
"<th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th>";
10589
10626
        print "<th>&nbsp;</th>";
10590
10627
        print "</tr>\n";
10591
10628
        my $total_h = 0;
 
10629
        my $total_p = 0;
10592
10630
        my $count = 0;
10593
10631
        &BuildKeyList( MinimumButNoZero( scalar keys %_browser_h, 500 ),
10594
 
                1, \%_browser_h, \%_browser_h );
 
10632
                1, \%_browser_h, \%_browser_p );
10595
10633
        my %keysinkeylist = ();
10596
10634
        my $max_h = 1;
 
10635
        my $max_p = 1;
10597
10636
 
10598
10637
        # Count total by family
10599
10638
        my %totalfamily_h = ();
10600
 
        my $TotalFamily   = 0;
 
10639
        my %totalfamily_p = ();
 
10640
        my $TotalFamily_h = 0;
 
10641
        my $TotalFamily_p = 0;
10601
10642
  BROWSERLOOP: foreach my $key (@keylist) {
10602
10643
                $total_h += $_browser_h{$key};
10603
10644
                if ( $_browser_h{$key} > $max_h ) {
10604
10645
                        $max_h = $_browser_h{$key};
10605
10646
                }
 
10647
                $total_p += $_browser_p{$key};
 
10648
                if ( $_browser_p{$key} > $max_p ) {
 
10649
                        $max_p = $_browser_p{$key};
 
10650
                }
10606
10651
                foreach my $family ( keys %BrowsersFamily ) {
10607
10652
                        if ( $key =~ /^$family/i ) {
10608
10653
                                $totalfamily_h{$family} += $_browser_h{$key};
10609
 
                                $TotalFamily            += $_browser_h{$key};
 
10654
                                $totalfamily_p{$family} += $_browser_p{$key};
 
10655
                                $TotalFamily_h          += $_browser_h{$key};
 
10656
                                $TotalFamily_p          += $_browser_p{$key};
10610
10657
                                next BROWSERLOOP;
10611
10658
                        }
10612
10659
                }
10618
10665
                keys %BrowsersFamily
10619
10666
          )
10620
10667
        {
10621
 
                my $p = '&nbsp;';
 
10668
                my $p_h = '&nbsp;';
 
10669
                my $p_p = '&nbsp;';
10622
10670
                if ($total_h) {
10623
 
                        $p = int( $totalfamily_h{$family} / $total_h * 1000 ) / 10;
10624
 
                        $p = "$p %";
 
10671
                        $p_h = int( $totalfamily_h{$family} / $total_h * 1000 ) / 10;
 
10672
                        $p_h = "$p_h %";
 
10673
                }
 
10674
                if ($total_p) {
 
10675
                        $p_p = int( $totalfamily_p{$family} / $total_p * 1000 ) / 10;
 
10676
                        $p_p = "$p_p %";
10625
10677
                }
10626
10678
                my $familyheadershown = 0;
10627
10679
 
10634
10686
                                  . uc($family)
10635
10687
                                  . "</b></td>";
10636
10688
                                print "<td>&nbsp;</td><td><b>"
 
10689
                                  . Format_Number(int( $totalfamily_p{$family} ))
 
10690
                                  . "</b></td><td><b>$p_p</b></td>";
 
10691
                                print "<td><b>"
10637
10692
                                  . Format_Number(int( $totalfamily_h{$family} ))
10638
 
                                  . "</b></td><td><b>$p</b></td><td>&nbsp;</td>";
 
10693
                                  . "</b></td><td><b>$p_h</b></td><td>&nbsp;</td>";
10639
10694
                                print "</tr>\n";
10640
10695
                                $familyheadershown = 1;
10641
10696
                        }
10642
10697
                        $keysinkeylist{$key} = 1;
10643
10698
                        my $ver = $1;
10644
 
                        my $p   = '&nbsp;';
 
10699
                        my $p_h = '&nbsp;';
 
10700
                        my $p_p = '&nbsp;';
10645
10701
                        if ($total_h) {
10646
 
                                $p =
 
10702
                                $p_h = 
10647
10703
                                  int( $_browser_h{$key} / $total_h * 1000 ) / 10;
10648
 
                                $p = "$p %";
 
10704
                                $p_h = "$p_h %";
 
10705
                        }
 
10706
                        if ($total_p) {
 
10707
                                $p_p =
 
10708
                                  int( $_browser_p{$key} / $total_p * 1000 ) / 10;
 
10709
                                $p_p = "$p_p %";
10649
10710
                        }
10650
10711
                        print "<tr>";
10651
10712
                        print "<td"
10664
10725
                          )
10665
10726
                          . "</td>";
10666
10727
                        my $bredde_h = 0;
 
10728
                        my $bredde_p = 0;
10667
10729
                        if ( $max_h > 0 ) {
10668
10730
                                $bredde_h =
10669
10731
                                  int( $BarWidth * ( $_browser_h{$key} || 0 ) /
10672
10734
                        if ( ( $bredde_h == 1 ) && $_browser_h{$key} ) {
10673
10735
                                $bredde_h = 2;
10674
10736
                        }
10675
 
                        print "<td>".Format_Number($_browser_h{$key})."</td><td>$p</td>";
 
10737
                        if ( $max_p > 0 ) {
 
10738
                                $bredde_p =
 
10739
                                  int( $BarWidth * ( $_browser_p{$key} || 0 ) /
 
10740
                                          $max_p ) + 1;
 
10741
                        }
 
10742
                        if ( ( $bredde_p == 1 ) && $_browser_p{$key} ) {
 
10743
                                $bredde_p = 2;
 
10744
                        }
 
10745
                        print "<td>".Format_Number($_browser_p{$key})."</td><td>$p_p</td>";
 
10746
                        print "<td>".Format_Number($_browser_h{$key})."</td><td>$p_h</td>";
10676
10747
                        print "<td class=\"aws\">";
10677
10748
 
10678
10749
                        # alt and title are not provided to reduce page size
10679
10750
                        if ($ShowBrowsersStats) {
10680
10751
                                print
 
10752
"<img src=\"$DirIcons\/other\/$BarPng{'hp'}\" width=\"$bredde_p\" height=\"5\" /><br />";
 
10753
                                print
10681
10754
"<img src=\"$DirIcons\/other\/$BarPng{'hh'}\" width=\"$bredde_h\" height=\"5\" /><br />";
10682
10755
                                }
10683
10756
                                print "</td>";
10692
10765
        foreach my $key (@keylist) {
10693
10766
                if ( $keysinkeylist{$key} ) { next; }
10694
10767
                if ( !$familyheadershown )  {
10695
 
                        my $p = '&nbsp;';
 
10768
                        my $p_h = '&nbsp;';
 
10769
                        my $p_p = '&nbsp;';
 
10770
                        if ($total_p) {
 
10771
                                $p_p =
 
10772
                                  int( ( $total_p - $TotalFamily_p ) / $total_p * 1000 ) /
 
10773
                                  10;
 
10774
                                $p_p = "$p_p %";
 
10775
                        }
10696
10776
                        if ($total_h) {
10697
 
                                $p =
10698
 
                                  int( ( $total_h - $TotalFamily ) / $total_h * 1000 ) /
 
10777
                                $p_h =
 
10778
                                  int( ( $total_h - $TotalFamily_h ) / $total_h * 1000 ) /
10699
10779
                                  10;
10700
 
                                $p = "$p %";
 
10780
                                $p_h = "$p_h %";
10701
10781
                        }
10702
10782
                        print
10703
10783
"<tr bgcolor=\"#F6F6F6\"><td class=\"aws\" colspan=\"2\"><b>$Message[2]</b></td>";
10704
10784
                        print "<td>&nbsp;</td><td><b>"
10705
 
                          . Format_Number(( $total_h - $TotalFamily ))
10706
 
                          . "</b></td><td><b>$p</b></td><td>&nbsp;</td>";
 
10785
                          . Format_Number(( $total_p - $TotalFamily_p ))
 
10786
                          . "</b></td><td><b>$p_p</b></td>";
 
10787
                        print "<td><b>"
 
10788
                          . Format_Number(( $total_h - $TotalFamily_h ))
 
10789
                          . "</b></td><td><b>$p_h</b></td><td>&nbsp;</td>";
10707
10790
                        print "</tr>\n";
10708
10791
                        $familyheadershown = 1;
10709
10792
                }
10710
 
                my $p = '&nbsp;';
 
10793
                my $p_h = '&nbsp;';
 
10794
                my $p_p = '&nbsp;';
10711
10795
                if ($total_h) {
10712
 
                        $p = int( $_browser_h{$key} / $total_h * 1000 ) / 10;
10713
 
                        $p = "$p %";
 
10796
                        $p_h = int( $_browser_h{$key} / $total_h * 1000 ) / 10;
 
10797
                        $p_h = "$p_h %";
 
10798
                }
 
10799
                if ($total_p) {
 
10800
                        $p_p = int( $_browser_p{$key} / $total_p * 1000 ) / 10;
 
10801
                        $p_p = "$p_p %";
10714
10802
                }
10715
10803
                print "<tr>";
10716
10804
                if ( $key eq 'Unknown' ) {
10740
10828
                          . "</td>";
10741
10829
                }
10742
10830
                my $bredde_h = 0;
 
10831
                my $bredde_p = 0;
10743
10832
                if ( $max_h > 0 ) {
10744
10833
                        $bredde_h =
10745
10834
                          int( $BarWidth * ( $_browser_h{$key} || 0 ) / $max_h ) +
10746
10835
                          1;
10747
10836
                }
 
10837
                if ( $max_p > 0 ) {
 
10838
                        $bredde_p =
 
10839
                          int( $BarWidth * ( $_browser_p{$key} || 0 ) / $max_p ) +
 
10840
                          1;
 
10841
                }
10748
10842
                if ( ( $bredde_h == 1 ) && $_browser_h{$key} ) {
10749
10843
                        $bredde_h = 2;
10750
10844
                }
10751
 
                print "<td>".Format_Number($_browser_h{$key})."</td><td>$p</td>";
 
10845
                if ( ( $bredde_p == 1 ) && $_browser_p{$key} ) {
 
10846
                        $bredde_p = 2;
 
10847
                }
 
10848
                print "<td>".Format_Number($_browser_p{$key})."</td><td>$p_p</td>";
 
10849
                print "<td>".Format_Number($_browser_h{$key})."</td><td>$p_h</td>";
10752
10850
                print "<td class=\"aws\">";
10753
10851
 
10754
10852
                # alt and title are not provided to reduce page size
10755
10853
                if ($ShowBrowsersStats) {
10756
10854
                        print
 
10855
"<img src=\"$DirIcons\/other\/$BarPng{'hp'}\" width=\"$bredde_p\" height=\"5\" /><br />";
 
10856
                        print
10757
10857
"<img src=\"$DirIcons\/other\/$BarPng{'hh'}\" width=\"$bredde_h\" height=\"5\" /><br />";
10758
10858
                }
10759
10859
                print "</td>";
10765
10865
 
10766
10866
#------------------------------------------------------------------------------
10767
10867
# Function:     Prints the Unknown Browser Detail frame or static page
10768
 
# Parameters:   _
 
10868
# Parameters:   $NewLinkTarget
10769
10869
# Input:        _
10770
10870
# Output:       HTML
10771
10871
# Return:       -
10772
10872
#------------------------------------------------------------------------------
10773
10873
sub HTMLShowBrowserUnknown{
 
10874
    my $NewLinkTarget = shift;
10774
10875
        print "$Center<a name=\"unknownbrowser\">&nbsp;</a><br />\n";
10775
10876
        my $title = "$Message[50]";
 
10877
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
10878
       # extend the title to include the added link 
 
10879
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
10880
               "$AddLinkToExternalCGIWrapper" . "?section=UNKNOWNREFERERBROWSER&baseName=$DirData/$PROG"
 
10881
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
10882
           . "&siteConfig=$SiteConfig" )
 
10883
           . "\"$NewLinkTarget>$Message[179]</a>");
 
10884
    } 
10776
10885
        &tab_head( "$title", 19, 0, 'unknownbrowser' );
10777
10886
        print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>User agent ("
10778
10887
          . ( scalar keys %_unknownrefererbrowser_l )
10816
10925
        print
10817
10926
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th colspan=\"2\">$Message[58]</th>";
10818
10927
        print
 
10928
"<th bgcolor=\"#$color_p\" width=\"80\">$Message[56]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[15]</th>";
 
10929
        print
10819
10930
"<th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th>";
10820
 
        print "<th>&nbsp;</th>";
10821
10931
        print "</tr>\n";
10822
10932
        my $total_h = 0;
 
10933
        my $total_p = 0;
10823
10934
        my $count = 0;
10824
10935
        &BuildKeyList( MinimumButNoZero( scalar keys %_os_h, 500 ),
10825
 
                1, \%_os_h, \%_os_h );
 
10936
                1, \%_os_h, \%_os_p );
10826
10937
        my %keysinkeylist = ();
10827
10938
        my $max_h = 1;
 
10939
        my $max_p = 1;
10828
10940
 
10829
10941
        # Count total by family
10830
10942
        my %totalfamily_h = ();
10831
 
        my $TotalFamily   = 0;
 
10943
        my %totalfamily_p = ();
 
10944
        my $TotalFamily_h = 0;
 
10945
        my $TotalFamily_p = 0;
10832
10946
  OSLOOP: foreach my $key (@keylist) {
10833
10947
                $total_h += $_os_h{$key};
 
10948
                $total_p += $_os_p{$key};
10834
10949
                if ( $_os_h{$key} > $max_h ) { $max_h = $_os_h{$key}; }
 
10950
                if ( $_os_p{$key} > $max_p ) { $max_p = $_os_p{$key}; }
10835
10951
                foreach my $family ( keys %OSFamily ) {
10836
10952
                        if ( $key =~ /^$family/i ) {
10837
10953
                                $totalfamily_h{$family} += $_os_h{$key};
10838
 
                                $TotalFamily            += $_os_h{$key};
 
10954
                                $totalfamily_p{$family} += $_os_p{$key};
 
10955
                                $TotalFamily_h          += $_os_h{$key};
 
10956
                                $TotalFamily_p          += $_os_p{$key};
10839
10957
                                next OSLOOP;
10840
10958
                        }
10841
10959
                }
10843
10961
 
10844
10962
        # Write records grouped in a browser family
10845
10963
        foreach my $family ( keys %OSFamily ) {
10846
 
                my $p = '&nbsp;';
 
10964
                my $p_h = '&nbsp;';
 
10965
                my $p_p = '&nbsp;';
10847
10966
                if ($total_h) {
10848
 
                        $p = int( $totalfamily_h{$family} / $total_h * 1000 ) / 10;
10849
 
                        $p = "$p %";
 
10967
                        $p_h = int( $totalfamily_h{$family} / $total_h * 1000 ) / 10;
 
10968
                        $p_h = "$p_h %";
 
10969
                }
 
10970
                if ($total_p) {
 
10971
                        $p_p = int( $totalfamily_p{$family} / $total_p * 1000 ) / 10;
 
10972
                        $p_p = "$p_p %";
10850
10973
                }
10851
10974
                my $familyheadershown = 0;
10852
10975
                foreach my $key ( reverse sort keys %_os_h ) {
10859
10982
                                        print
10860
10983
"<tr bgcolor=\"#F6F6F6\"><td class=\"aws\" colspan=\"2\"><b>$family_name</b></td>";
10861
10984
                                        print "<td><b>"
 
10985
                                          . Format_Number(int( $totalfamily_p{$family} ))
 
10986
                                          . "</b></td><td><b>$p_p</b></td>";
 
10987
                                        print "<td><b>"
10862
10988
                                          . Format_Number(int( $totalfamily_h{$family} ))
10863
 
                                          . "</b></td><td><b>$p</b></td><td>&nbsp;</td>";
 
10989
                                          . "</b></td><td><b>$p_h</b></td><td>&nbsp;</td>";
10864
10990
                                        print "</tr>\n";
10865
10991
                                        $familyheadershown = 1;
10866
10992
                                }
10867
10993
                                $keysinkeylist{$key} = 1;
10868
10994
                                my $ver = $1;
10869
 
                                my $p   = '&nbsp;';
 
10995
                                my $p_h = '&nbsp;';
 
10996
                                my $p_p = '&nbsp;';
10870
10997
                                if ($total_h) {
10871
 
                                        $p = int( $_os_h{$key} / $total_h * 1000 ) / 10;
10872
 
                                        $p = "$p %";
 
10998
                                        $p_h = int( $_os_h{$key} / $total_h * 1000 ) / 10;
 
10999
                                        $p_h = "$p_h %";
 
11000
                                }
 
11001
                                if ($total_p) {
 
11002
                                        $p_p = int( $_os_p{$key} / $total_p * 1000 ) / 10;
 
11003
                                        $p_p = "$p_p %";
10873
11004
                                }
10874
11005
                                print "<tr>";
10875
11006
                                print "<td"
10880
11011
 
10881
11012
                                print "<td class=\"aws\">$OSHashLib{$key}</td>";
10882
11013
                                my $bredde_h = 0;
 
11014
                                my $bredde_p = 0;
10883
11015
                                if ( $max_h > 0 ) {
10884
11016
                                        $bredde_h =
10885
11017
                                          int( $BarWidth * ( $_os_h{$key} || 0 ) / $max_h )
10888
11020
                                if ( ( $bredde_h == 1 ) && $_os_h{$key} ) {
10889
11021
                                        $bredde_h = 2;
10890
11022
                                }
10891
 
                                print "<td>".Format_Number($_os_h{$key})."</td><td>$p</td>";
 
11023
                                if ( $max_p > 0 ) {
 
11024
                                        $bredde_p =
 
11025
                                          int( $BarWidth * ( $_os_p{$key} || 0 ) / $max_p )
 
11026
                                          + 1;
 
11027
                                }
 
11028
                                if ( ( $bredde_p == 1 ) && $_os_p{$key} ) {
 
11029
                                        $bredde_p = 2;
 
11030
                                }
 
11031
                                print "<td>".Format_Number($_os_p{$key})."</td><td>$p_p</td>";
 
11032
                                print "<td>".Format_Number($_os_h{$key})."</td><td>$p_h</td>";
10892
11033
                                print "<td class=\"aws\">";
10893
11034
 
10894
11035
                                # alt and title are not provided to reduce page size
10895
11036
                                if ($ShowOSStats) {
10896
11037
                                        print
 
11038
"<img src=\"$DirIcons\/other\/$BarPng{'hp'}\" width=\"$bredde_p\" height=\"5\" /><br />";
 
11039
                                        print
10897
11040
"<img src=\"$DirIcons\/other\/$BarPng{'hh'}\" width=\"$bredde_h\" height=\"5\" /><br />";
10898
11041
                                }
10899
11042
                                print "</td>";
10908
11051
        foreach my $key (@keylist) {
10909
11052
                if ( $keysinkeylist{$key} ) { next; }
10910
11053
                if ( !$familyheadershown )  {
10911
 
                        my $p = '&nbsp;';
 
11054
                        my $p_h = '&nbsp;';
 
11055
                        my $p_p = '&nbsp;';
10912
11056
                        if ($total_h) {
10913
 
                                $p =
10914
 
                                  int( ( $total_h - $TotalFamily ) / $total_h * 1000 ) /
10915
 
                                  10;
10916
 
                                $p = "$p %";
 
11057
                                $p_h =
 
11058
                                  int( ( $total_h - $TotalFamily_h ) / $total_h * 1000 ) /
 
11059
                                  10;
 
11060
                                $p_h = "$p_h %";
 
11061
                        }
 
11062
                        if ($total_p) {
 
11063
                                $p_p =
 
11064
                                  int( ( $total_p - $TotalFamily_p ) / $total_p * 1000 ) /
 
11065
                                  10;
 
11066
                                $p_p = "$p_p %";
10917
11067
                        }
10918
11068
                        print
10919
11069
"<tr bgcolor=\"#F6F6F6\"><td class=\"aws\" colspan=\"2\"><b>$Message[2]</b></td>";
10920
11070
                        print "<td><b>"
10921
 
                          . Format_Number(( $total_h - $TotalFamily ))
10922
 
                          . "</b></td><td><b>$p</b></td><td>&nbsp;</td>";
 
11071
                          . Format_Number(( $total_p - $TotalFamily_p ))
 
11072
                          . "</b></td><td><b>$p_p</b></td>";
 
11073
                        print "<td><b>"
 
11074
                          . Format_Number(( $total_h - $TotalFamily_h ))
 
11075
                          . "</b></td><td><b>$p_h</b></td><td>&nbsp;</td>";
10923
11076
                        print "</tr>\n";
10924
11077
                        $familyheadershown = 1;
10925
11078
                }
10926
 
                my $p = '&nbsp;';
 
11079
                my $p_h = '&nbsp;';
 
11080
                my $p_p = '&nbsp;';
10927
11081
                if ($total_h) {
10928
 
                        $p = int( $_os_h{$key} / $total_h * 1000 ) / 10;
10929
 
                        $p = "$p %";
 
11082
                        $p_h = int( $_os_h{$key} / $total_h * 1000 ) / 10;
 
11083
                        $p_h = "$p_h %";
 
11084
                }
 
11085
                if ($total_p) {
 
11086
                        $p_p = int( $_os_p{$key} / $total_p * 1000 ) / 10;
 
11087
                        $p_p = "$p_p %";
10930
11088
                }
10931
11089
                print "<tr>";
10932
11090
                if ( $key eq 'Unknown' ) {
10950
11108
                          . " /></td><td class=\"aws\">$libos</td>";
10951
11109
                }
10952
11110
                my $bredde_h = 0;
 
11111
                my $bredde_p = 0;
10953
11112
                if ( $max_h > 0 ) {
10954
11113
                        $bredde_h =
10955
11114
                          int( $BarWidth * ( $_os_h{$key} || 0 ) / $max_h ) + 1;
10956
11115
                }
10957
11116
                if ( ( $bredde_h == 1 ) && $_os_h{$key} ) { $bredde_h = 2; }
10958
 
                print "<td>".Format_Number($_os_h{$key})."</td><td>$p</td>";
 
11117
                if ( $max_p > 0 ) {
 
11118
                        $bredde_p =
 
11119
                          int( $BarWidth * ( $_os_p{$key} || 0 ) / $max_p ) + 1;
 
11120
                }
 
11121
                if ( ( $bredde_p == 1 ) && $_os_p{$key} ) { $bredde_p = 2; }
 
11122
                print "<td>".Format_Number($_os_p{$key})."</td><td>$p_p</td>";
 
11123
                print "<td>".Format_Number($_os_h{$key})."</td><td>$p_h</td>";
10959
11124
                print "<td class=\"aws\">";
10960
11125
 
10961
11126
                # alt and title are not provided to reduce page size
10962
11127
                if ($ShowOSStats) {
10963
11128
                        print
 
11129
"<img src=\"$DirIcons\/other\/$BarPng{'hp'}\" width=\"$bredde_p\" height=\"5\" /><br />";
 
11130
                        print
10964
11131
"<img src=\"$DirIcons\/other\/$BarPng{'hh'}\" width=\"$bredde_h\" height=\"5\" /><br />";
10965
11132
                }
10966
11133
                print "</td>";
10972
11139
 
10973
11140
#------------------------------------------------------------------------------
10974
11141
# Function:     Prints the Unkown OS Detail frame or static page
10975
 
# Parameters:   _
 
11142
# Parameters:   $NewLinkTarget
10976
11143
# Input:        _
10977
11144
# Output:       HTML
10978
11145
# Return:       -
10979
11146
#------------------------------------------------------------------------------
10980
11147
sub HTMLShowOSUnknown{
 
11148
    my $NewLinkTarget = shift;
10981
11149
        print "$Center<a name=\"unknownos\">&nbsp;</a><br />\n";
10982
11150
        my $title = "$Message[46]";
10983
 
        &tab_head( "$title", 19, 0, 'unknownos' );
 
11151
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
11152
       # extend the title to include the added link 
 
11153
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
11154
               "$AddLinkToExternalCGIWrapper" . "?section=UNKNOWNREFERER&baseName=$DirData/$PROG"
 
11155
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
11156
           . "&siteConfig=$SiteConfig" )
 
11157
           . "\"$NewLinkTarget>$Message[179]</a>");
 
11158
    } 
 
11159
    &tab_head( "$title", 19, 0, 'unknownos' );
10984
11160
        print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>User agent ("
10985
11161
          . ( scalar keys %_unknownreferer_l )
10986
11162
          . ")</th><th>$Message[9]</th></tr>\n";
11010
11186
 
11011
11187
#------------------------------------------------------------------------------
11012
11188
# Function:     Prints the Referers frame or static page
11013
 
# Parameters:   _
 
11189
# Parameters:   $NewLinkTarget
11014
11190
# Input:        _
11015
11191
# Output:       HTML
11016
11192
# Return:       -
11017
11193
#------------------------------------------------------------------------------
11018
11194
sub HTMLShowReferers{
 
11195
    my $NewLinkTarget = shift;
11019
11196
        print "$Center<a name=\"refererse\">&nbsp;</a><br />\n";
11020
11197
        my $title = "$Message[40]";
11021
 
        &tab_head( "$title", 19, 0, 'refererse' );
 
11198
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
11199
       # extend the title to include the added link 
 
11200
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
11201
               "$AddLinkToExternalCGIWrapper" . "?section=SEREFERRALS&baseName=$DirData/$PROG"
 
11202
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
11203
           . "&siteConfig=$SiteConfig" )
 
11204
           . "\"$NewLinkTarget>$Message[179]</a>");
 
11205
    } 
 
11206
    &tab_head( $title, 19, 0, 'refererse' );
11022
11207
        print
11023
11208
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th>".Format_Number($TotalDifferentSearchEngines)." $Message[122]</th>";
11024
11209
        print
11103
11288
 
11104
11289
#------------------------------------------------------------------------------
11105
11290
# Function:     Prints the Referer Pages frame or static page
11106
 
# Parameters:   _
 
11291
# Parameters:   $NewLinkTarget
11107
11292
# Input:        _
11108
11293
# Output:       HTML
11109
11294
# Return:       -
11110
11295
#------------------------------------------------------------------------------
11111
11296
sub HTMLShowRefererPages{
 
11297
    my $NewLinkTarget = shift;
11112
11298
        print "$Center<a name=\"refererpages\">&nbsp;</a><br />\n";
11113
11299
        my $total_p = 0;
11114
11300
        my $total_h = 0;
11122
11308
                $FilterEx{'refererpages'}
11123
11309
        );
11124
11310
        my $title = "$Message[41]";
11125
 
        my $cpt   = 0;
 
11311
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
11312
       # extend the title to include the added link 
 
11313
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
11314
               "$AddLinkToExternalCGIWrapper" . "?section=PAGEREFS&baseName=$DirData/$PROG"
 
11315
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
11316
           . "&siteConfig=$SiteConfig" )
 
11317
           . "\"$NewLinkTarget>$Message[179]</a>");
 
11318
    }
 
11319
    my $cpt   = 0;
11126
11320
        $cpt = ( scalar keys %_pagesrefs_h );
11127
11321
        &tab_head( "$title", 19, 0, 'refererpages' );
11128
11322
        print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>";
11232
11426
 
11233
11427
#------------------------------------------------------------------------------
11234
11428
# Function:     Prints the Key Phrases frame or static page
11235
 
# Parameters:   _
 
11429
# Parameters:   $NewLinkTarget
11236
11430
# Input:        _
11237
11431
# Output:       HTML
11238
11432
# Return:       -
11239
11433
#------------------------------------------------------------------------------
11240
11434
sub HTMLShowKeyPhrases{
 
11435
        my $NewLinkTarget = shift;
11241
11436
        print "$Center<a name=\"keyphrases\">&nbsp;</a><br />\n";
11242
 
        &tab_head( $Message[43], 19, 0, 'keyphrases' );
 
11437
    my $title = "$Message[43]";
 
11438
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
11439
       # extend the title to include the added link 
 
11440
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
11441
               "$AddLinkToExternalCGIWrapper" . "?section=SEARCHWORDS&baseName=$DirData/$PROG"
 
11442
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
11443
           . "&siteConfig=$SiteConfig" )
 
11444
           . "\"$NewLinkTarget>$Message[179]</a>");
 
11445
    } 
 
11446
        &tab_head( $title, 19, 0, 'keyphrases' );
11243
11447
        print "<tr bgcolor=\"#$color_TableBGRowTitle\""
11244
11448
          . Tooltip(15)
11245
11449
          . "><th>".Format_Number($TotalDifferentKeyphrases)." $Message[103]</th><th bgcolor=\"#$color_s\" width=\"80\">$Message[14]</th><th bgcolor=\"#$color_s\" width=\"80\">$Message[15]</th></tr>\n";
11290
11494
 
11291
11495
#------------------------------------------------------------------------------
11292
11496
# Function:     Prints the Keywords frame or static page
11293
 
# Parameters:   _
 
11497
# Parameters:   $NewLinkTarget
11294
11498
# Input:        _
11295
11499
# Output:       HTML
11296
11500
# Return:       -
11297
11501
#------------------------------------------------------------------------------
11298
11502
sub HTMLShowKeywords{
 
11503
        my $NewLinkTarget = shift;
11299
11504
        print "$Center<a name=\"keywords\">&nbsp;</a><br />\n";
11300
 
        &tab_head( $Message[44], 19, 0, 'keywords' );
 
11505
        my $title = "$Message[44]";
 
11506
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
11507
       # extend the title to include the added link 
 
11508
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
11509
               "$AddLinkToExternalCGIWrapper" . "?section=KEYWORDS&baseName=$DirData/$PROG"
 
11510
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
11511
           . "&siteConfig=$SiteConfig" )
 
11512
           . "\"$NewLinkTarget>$Message[179]</a>");
 
11513
    } 
 
11514
        &tab_head( $title, 19, 0, 'keywords' );
11301
11515
        print "<tr bgcolor=\"#$color_TableBGRowTitle\""
11302
11516
          . Tooltip(15)
11303
11517
          . "><th>".Format_Number($TotalDifferentKeywords)." $Message[13]</th><th bgcolor=\"#$color_s\" width=\"80\">$Message[14]</th><th bgcolor=\"#$color_s\" width=\"80\">$Message[15]</th></tr>\n";
13148
13362
        
13149
13363
        if ($Debug) { debug( "ShowDaysOfMonthStats", 2 ); }
13150
13364
        print "$Center<a name=\"daysofmonth\">&nbsp;</a><br />\n";
 
13365
 
 
13366
        my $NewLinkParams = ${QueryString};
 
13367
        $NewLinkParams =~ s/(^|&|&amp;)update(=\w*|$)//i;
 
13368
        $NewLinkParams =~ s/(^|&|&amp;)staticlinks(=\w*|$)//i;
 
13369
        $NewLinkParams =~ s/(^|&|&amp;)year=[^&]*//i;
 
13370
        $NewLinkParams =~ s/(^|&|&amp;)month=[^&]*//i;
 
13371
        $NewLinkParams =~ s/(^|&|&amp;)framename=[^&]*//i;
 
13372
        $NewLinkParams =~ s/(&amp;|&)+/&amp;/i;
 
13373
        $NewLinkParams =~ s/^&amp;//;
 
13374
        $NewLinkParams =~ s/&amp;$//;
 
13375
        if ($NewLinkParams) { $NewLinkParams = "${NewLinkParams}&amp;"; }
 
13376
        my $NewLinkTarget = '';
 
13377
 
 
13378
        if ( $FrameName eq 'mainright' ) {
 
13379
                $NewLinkTarget = " target=\"_parent\"";
 
13380
        }
 
13381
 
13151
13382
        my $title = "$Message[138]";
 
13383
 
 
13384
    if ($AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
13385
        # extend the title to include the added link
 
13386
            $title = "$title &nbsp; - &nbsp; <a href=\"".(XMLEncode(
 
13387
                "$AddLinkToExternalCGIWrapper". "?section=DAY&baseName=$DirData/$PROG"
 
13388
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
13389
           . "&siteConfig=$SiteConfig" )
 
13390
           . "\"$NewLinkTarget>$Message[179]</a>");
 
13391
    }
 
13392
 
13152
13393
        &tab_head( "$title", 0, 0, 'daysofmonth' );
13153
13394
        print "<tr>";
13154
13395
        print "<td align=\"center\">\n";
13155
13396
        print "<center>\n";
13156
 
 
13157
 
        my $NewLinkParams = ${QueryString};
13158
 
        $NewLinkParams =~ s/(^|&|&amp;)update(=\w*|$)//i;
13159
 
        $NewLinkParams =~ s/(^|&|&amp;)staticlinks(=\w*|$)//i;
13160
 
        $NewLinkParams =~ s/(^|&|&amp;)year=[^&]*//i;
13161
 
        $NewLinkParams =~ s/(^|&|&amp;)month=[^&]*//i;
13162
 
        $NewLinkParams =~ s/(^|&|&amp;)framename=[^&]*//i;
13163
 
        $NewLinkParams =~ s/(&amp;|&)+/&amp;/i;
13164
 
        $NewLinkParams =~ s/^&amp;//;
13165
 
        $NewLinkParams =~ s/&amp;$//;
13166
 
        if ($NewLinkParams) { $NewLinkParams = "${NewLinkParams}&amp;"; }
13167
 
        my $NewLinkTarget = '';
13168
 
 
13169
 
        if ( $FrameName eq 'mainright' ) {
13170
 
                $NewLinkTarget = " target=\"_parent\"";
13171
 
        }
13172
 
 
 
13397
        
13173
13398
        my $average_v = my $average_p = 0;
13174
13399
        my $average_h = my $average_k = 0;
13175
13400
        my $total_u = my $total_v = my $total_p = my $total_h = my $total_k = 0;
13491
13716
                        print(   !$StaticLinks
13492
13717
                                  && $day == $nowday
13493
13718
                                  && $month == $nowmonth
13494
 
                                  && $year == $nowyear ? '</span>' : '' );
 
13719
                                  && $year == $nowyear ? '</font>' : '' );
13495
13720
                        print "</td>";
13496
13721
                        if ( $ShowDaysOfMonthStats =~ /V/i ) {
13497
13722
                                print "<td>",
13571
13796
sub HTMLMainDaysofWeek{
13572
13797
        my $firstdaytocountaverage = shift;
13573
13798
        my $lastdaytocountaverage = shift;
 
13799
    my $NewLinkParams = shift;
 
13800
    my $NewLinkTarget = shift;  
 
13801
    
13574
13802
        if ($Debug) { debug( "ShowDaysOfWeekStats", 2 ); }
13575
13803
                        print "$Center<a name=\"daysofweek\">&nbsp;</a><br />\n";
13576
13804
                        my $title = "$Message[91]";
13794
14022
                                        print(   !$StaticLinks
13795
14023
                                                  && $_ == ( $nowwday - 1 )
13796
14024
                                                  && $MonthRequired == $nowmonth
13797
 
                                                  && $YearRequired == $nowyear ? '</span>' : '' );
 
14025
                                                  && $YearRequired == $nowyear ? '</font>' : '' );
13798
14026
                                        print "</td>";
13799
14027
                                }
13800
14028
                                print "</tr>\n</table>\n";
13863
14091
#------------------------------------------------------------------------------
13864
14092
# Function:     Prints the Downloads chart and table
13865
14093
# Parameters:   -
13866
 
# Input:        -
 
14094
# Input:        $NewLinkParams, $NewLinkTarget
13867
14095
# Output:       HTML
13868
14096
# Return:       -
13869
14097
#------------------------------------------------------------------------------
13885
14113
                : "$StaticLinks.downloads.$StaticExt"
13886
14114
          )
13887
14115
          . "\"$NewLinkTarget>$Message[80]</a>";
 
14116
 
 
14117
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
14118
        # extend the title to include the added link
 
14119
            $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
14120
                "$AddLinkToExternalCGIWrapper" . "?section=DOWNLOADS&baseName=$DirData/$PROG"
 
14121
            . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
14122
            . "&siteConfig=$SiteConfig" )
 
14123
            . "\"$NewLinkTarget>$Message[179]</a>");
 
14124
    }
 
14125
          
13888
14126
        &tab_head( "$title", 0, 0, 'downloads' );
13889
14127
        my $cnt=0;
13890
14128
        for my $u (sort {$_downloads{$b}->{'AWSTATS_HITS'} <=> $_downloads{$a}->{'AWSTATS_HITS'}}(keys %_downloads) ){
13972
14210
 
13973
14211
#------------------------------------------------------------------------------
13974
14212
# Function:     Prints the hours chart and table
13975
 
# Parameters:   -
 
14213
# Parameters:   $NewLinkParams, $NewLinkTarget
13976
14214
# Input:        -
13977
14215
# Output:       HTML
13978
14216
# Return:       -
13979
14217
#------------------------------------------------------------------------------
13980
14218
sub HTMLMainHours{
13981
 
        if ($Debug) { debug( "ShowHoursStats", 2 ); }
 
14219
    my $NewLinkParams = shift;
 
14220
    my $NewLinkTarget = shift;
 
14221
        
 
14222
    if ($Debug) { debug( "ShowHoursStats", 2 ); }
13982
14223
        print "$Center<a name=\"hours\">&nbsp;</a><br />\n";
13983
14224
        my $title = "$Message[20]";
 
14225
        
 
14226
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
14227
       # extend the title to include the added link 
 
14228
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
14229
               "$AddLinkToExternalCGIWrapper" . "?section=TIME&baseName=$DirData/$PROG"
 
14230
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
14231
           . "&siteConfig=$SiteConfig" )
 
14232
           . "\"$NewLinkTarget>$Message[179]</a>");
 
14233
    } 
 
14234
        
13984
14235
        if ( $PluginsLoaded{'GetTimeZoneTitle'}{'timezone'} ) {
13985
14236
                $title .= " (GMT "
13986
14237
                  . ( GetTimeZoneTitle_timezone() >= 0 ? "+" : "" )
14213
14464
                : "$StaticLinks.alldomains.$StaticExt"
14214
14465
          )
14215
14466
          . "\"$NewLinkTarget>$Message[80]</a>";
 
14467
          
 
14468
 
 
14469
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
14470
       # extend the title to include the added link
 
14471
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
14472
               "$AddLinkToExternalCGIWrapper" . "?section=DOMAIN&baseName=$DirData/$PROG"
 
14473
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
14474
           . "&siteConfig=$SiteConfig" )
 
14475
           . "\"$NewLinkTarget>$Message[179]</a>");
 
14476
    }
 
14477
                  
14216
14478
        &tab_head( "$title", 19, 0, 'countries' );
14217
14479
        
14218
14480
        my $total_u = my $total_v = my $total_p = my $total_h = my $total_k = 0;
14457
14719
                : "$StaticLinks.unknownip.$StaticExt"
14458
14720
          )
14459
14721
          . "\"$NewLinkTarget>$Message[45]</a>";
 
14722
          
 
14723
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
14724
       # extend the title to include the added link
 
14725
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
14726
               "$AddLinkToExternalCGIWrapper" . "?section=VISITOR&baseName=$DirData/$PROG"
 
14727
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
14728
           . "&siteConfig=$SiteConfig" )
 
14729
           . "\"$NewLinkTarget>$Message[179]</a>");
 
14730
    }
 
14731
          
14460
14732
        &tab_head( "$title", 19, 0, 'visitors' );
14461
14733
        
14462
14734
        &BuildKeyList( $MaxNbOf{'HostsShown'}, $MinHit{'Host'}, \%_host_h,
14719
14991
        
14720
14992
        if ($Debug) { debug( "ShowRobotStats", 2 ); }
14721
14993
        print "$Center<a name=\"robots\">&nbsp;</a><br />\n";
14722
 
        &tab_head(
14723
 
"$Message[53] ($Message[77] $MaxNbOf{'RobotShown'}) &nbsp; - &nbsp; <a href=\""
 
14994
 
 
14995
        my $title = "$Message[53] ($Message[77] $MaxNbOf{'RobotShown'}) &nbsp; - &nbsp; <a href=\""
14724
14996
                  . (
14725
14997
                        $ENV{'GATEWAY_INTERFACE'}
14726
14998
                          || !$StaticLinks
14734
15006
                        ? XMLEncode("$AWScript${NewLinkParams}output=lastrobots")
14735
15007
                        : "$StaticLinks.lastrobots.$StaticExt"
14736
15008
                  )
14737
 
                  . "\"$NewLinkTarget>$Message[9]</a>",
14738
 
                19, 0, 'robots'
14739
 
        );
14740
 
        print "<tr bgcolor=\"#$color_TableBGRowTitle\""
 
15009
                  . "\"$NewLinkTarget>$Message[9]</a>";
 
15010
 
 
15011
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
15012
       # extend the title to include the added link
 
15013
           $title = "$title &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
15014
               "$AddLinkToExternalCGIWrapper" . "?section=ROBOT&baseName=$DirData/$PROG"
 
15015
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
15016
           . "&siteConfig=$SiteConfig" )
 
15017
           . "\"$NewLinkTarget>$Message[179]</a>");
 
15018
    }
 
15019
        
 
15020
    &tab_head( "$title", 19, 0, 'robots');
 
15021
        
 
15022
    print "<tr bgcolor=\"#$color_TableBGRowTitle\""
14741
15023
          . Tooltip(16) . "><th>"
14742
15024
          . Format_Number(( scalar keys %_robot_h ))
14743
15025
          . " $Message[51]*</th>";
15018
15300
                  )
15019
15301
                  . "\"$NewLinkTarget>$Message[116]</a>";
15020
15302
        }
 
15303
        
 
15304
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
15305
       # extend the title to include the added link
 
15306
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
15307
               "$AddLinkToExternalCGIWrapper" . "?section=SIDER&baseName=$DirData/$PROG"
 
15308
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
15309
           . "&siteConfig=$SiteConfig" )
 
15310
           . "\"$NewLinkTarget>$Message[179]</a>");
 
15311
    }
 
15312
                
15021
15313
        &tab_head( "$title", 19, 0, 'urls' );
15022
15314
        print
15023
15315
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th>".Format_Number($TotalDifferentPages)." $Message[28]</th>";
15227
15519
        if ($Debug) { debug( "ShowOSStats", 2 ); }
15228
15520
        print "$Center<a name=\"os\">&nbsp;</a><br />\n";
15229
15521
        my $Totalh   = 0;
 
15522
        my $Totalp   = 0;
15230
15523
        my %new_os_h = ();
 
15524
        my %new_os_p = ();
15231
15525
  OSLOOP: foreach my $key ( keys %_os_h ) {
15232
15526
                $Totalh += $_os_h{$key};
 
15527
                $Totalp += $_os_p{$key};
15233
15528
                foreach my $family ( keys %OSFamily ) {
15234
15529
                        if ( $key =~ /^$family/i ) {
15235
15530
                                $new_os_h{"${family}cumul"} += $_os_h{$key};
 
15531
                                $new_os_p{"${family}cumul"} += $_os_p{$key};
15236
15532
                                next OSLOOP;
15237
15533
                        }
15238
15534
                }
15239
15535
                $new_os_h{$key} += $_os_h{$key};
 
15536
                $new_os_p{$key} += $_os_p{$key};
15240
15537
        }
15241
15538
        my $title =
15242
15539
"$Message[59] ($Message[77] $MaxNbOf{'OsShown'}) &nbsp; - &nbsp; <a href=\""
15254
15551
                : "$StaticLinks.unknownos.$StaticExt"
15255
15552
          )
15256
15553
          . "\"$NewLinkTarget>$Message[0]</a>";
 
15554
          
 
15555
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
15556
       # extend the title to include the added link
 
15557
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
15558
               "$AddLinkToExternalCGIWrapper" . "?section=OS&baseName=$DirData/$PROG"
 
15559
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
15560
           . "&siteConfig=$SiteConfig" )
 
15561
           . "\"$NewLinkTarget>$Message[179]</a>");
 
15562
    }
 
15563
                  
15257
15564
        &tab_head( "$title", 19, 0, 'os' );
15258
15565
        
15259
15566
        &BuildKeyList( $MaxNbOf{'OsShown'}, $MinHit{'Os'}, \%new_os_h,
15260
 
                \%new_os_h );
 
15567
                \%new_os_p );
15261
15568
                
15262
15569
        # Graph the top five in a pie chart
15263
15570
        if (scalar @keylist > 1){
15299
15606
        }
15300
15607
        
15301
15608
        print
15302
 
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th width=\"$WIDTHCOLICON\">&nbsp;</th><th>$Message[59]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th></tr>\n";
 
15609
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th width=\"$WIDTHCOLICON\">&nbsp;</th><th>$Message[59]</th>";
 
15610
        print
 
15611
"<th bgcolor=\"#$color_p\" width=\"80\">$Message[56]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[15]</th>";
 
15612
        print
 
15613
"<th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th></tr>\n";
15303
15614
        my $total_h = 0;
 
15615
        my $total_p = 0;
15304
15616
        my $count = 0;
15305
15617
        
15306
15618
        foreach my $key (@keylist) {
15307
 
                my $p = '&nbsp;';
 
15619
                my $p_h = '&nbsp;';
 
15620
                my $p_p = '&nbsp;';
15308
15621
                if ($Totalh) {
15309
 
                        $p = int( $new_os_h{$key} / $Totalh * 1000 ) / 10;
15310
 
                        $p = "$p %";
 
15622
                        $p_h = int( $new_os_h{$key} / $Totalh * 1000 ) / 10;
 
15623
                        $p_h = "$p_h %";
 
15624
                }
 
15625
                if ($Totalp) {
 
15626
                        $p_p = int( $new_os_p{$key} / $Totalp * 1000 ) / 10;
 
15627
                        $p_p = "$p_p %";
15311
15628
                }
15312
15629
                if ( $key eq 'Unknown' ) {
15313
15630
                        print "<tr><td"
15314
15631
                          . ( $count ? "" : " width=\"$WIDTHCOLICON\"" )
15315
15632
                          . "><img src=\"$DirIcons\/os\/unknown.png\""
15316
15633
                          . AltTitle("")
15317
 
                          . " /></td><td class=\"aws\"><span style=\"color: #$color_other\">$Message[0]</span></td><td>".Format_Number($_os_h{$key})."</td><td>$p</td></tr>\n";
 
15634
                          . " /></td><td class=\"aws\"><span style=\"color: #$color_other\">$Message[0]</span></td>"
 
15635
                          . "<td>".Format_Number($_os_p{$key})."</td><td>$p_p</td><td>".Format_Number($_os_h{$key})."</td><td>$p_h</td></tr>\n";
15318
15636
                }
15319
15637
                else {
15320
15638
                        my $keywithoutcumul = $key;
15330
15648
                          . ( $count ? "" : " width=\"$WIDTHCOLICON\"" )
15331
15649
                          . "><img src=\"$DirIcons\/os\/$nameicon.png\""
15332
15650
                          . AltTitle("")
15333
 
                          . " /></td><td class=\"aws\">$libos</td><td>".Format_Number($new_os_h{$key})."</td><td>$p</td></tr>\n";
 
15651
                          . " /></td><td class=\"aws\">$libos</td><td>".Format_Number($new_os_p{$key})."</td><td>$p_p</td><td>".Format_Number($new_os_h{$key})."</td><td>$p_h</td></tr>\n";
15334
15652
                }
15335
15653
                $total_h += $new_os_h{$key};
 
15654
                $total_p += $new_os_p{$key};
15336
15655
                $count++;
15337
15656
        }
15338
15657
        if ($Debug) {
15339
15658
                debug( "Total real / shown : $Totalh / $total_h", 2 );
15340
15659
        }
15341
15660
        my $rest_h = $Totalh - $total_h;
 
15661
        my $rest_p = $Totalp - $total_p;
15342
15662
        if ( $rest_h > 0 ) {
15343
 
                my $p;
15344
 
                if ($Totalh) { $p = int( $rest_h / $Totalh * 1000 ) / 10; }
 
15663
                my $p_p;
 
15664
                my $p_h;
 
15665
                if ($Totalh) { $p_h = int( $rest_h / $Totalh * 1000 ) / 10; }
 
15666
                if ($Totalp) { $p_p = int( $rest_p / $Totalp * 1000 ) / 10; }
15345
15667
                print "<tr>";
15346
15668
                print "<td>&nbsp;</td>";
15347
15669
                print
15348
 
"<td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]</span></td><td>".Format_Number($rest_h)."</td>";
15349
 
                print "<td>$p %</td></tr>\n";
 
15670
"<td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]</span></td><td>".Format_Number($rest_p)."</td>";
 
15671
                print "<td>$p_p %</td><td>".Format_Number($rest_h)."</td><td>$p_h %</td></tr>\n";
15350
15672
        }
15351
15673
        &tab_end();
15352
15674
}
15365
15687
        if ($Debug) { debug( "ShowBrowsersStats", 2 ); }
15366
15688
        print "$Center<a name=\"browsers\">&nbsp;</a><br />\n";
15367
15689
        my $Totalh        = 0;
 
15690
        my $Totalp        = 0;
15368
15691
        my %new_browser_h = ();
 
15692
        my %new_browser_p = ();
15369
15693
  BROWSERLOOP: foreach my $key ( keys %_browser_h ) {
15370
15694
                $Totalh += $_browser_h{$key};
 
15695
                $Totalp += $_browser_p{$key};
15371
15696
                foreach my $family ( keys %BrowsersFamily ) {
15372
15697
                        if ( $key =~ /^$family/i ) {
15373
15698
                                $new_browser_h{"${family}cumul"} += $_browser_h{$key};
 
15699
                                $new_browser_p{"${family}cumul"} += $_browser_p{$key};
15374
15700
                                next BROWSERLOOP;
15375
15701
                        }
15376
15702
                }
15377
15703
                $new_browser_h{$key} += $_browser_h{$key};
 
15704
                $new_browser_p{$key} += $_browser_p{$key};
15378
15705
        }
15379
15706
        my $title =
15380
15707
"$Message[21] ($Message[77] $MaxNbOf{'BrowsersShown'}) &nbsp; - &nbsp; <a href=\""
15392
15719
                : "$StaticLinks.unknownbrowser.$StaticExt"
15393
15720
          )
15394
15721
          . "\"$NewLinkTarget>$Message[0]</a>";
 
15722
          
 
15723
 
 
15724
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
15725
       # extend the title to include the added link
 
15726
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
15727
               "$AddLinkToExternalCGIWrapper" . "?section=BROWSER&baseName=$DirData/$PROG"
 
15728
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
15729
           . "&siteConfig=$SiteConfig" )
 
15730
           . "\"$NewLinkTarget>$Message[179]</a>");
 
15731
    }
 
15732
                  
15395
15733
        &tab_head( "$title", 19, 0, 'browsers' );
15396
15734
        
15397
15735
        &BuildKeyList(
15398
15736
                $MaxNbOf{'BrowsersShown'}, $MinHit{'Browser'},
15399
 
                \%new_browser_h,           \%new_browser_h
 
15737
                \%new_browser_h,           \%new_browser_p
15400
15738
        );
15401
15739
        
15402
15740
        # Graph the top five in a pie chart
15438
15776
                }
15439
15777
        }
15440
15778
        print
15441
 
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th width=\"$WIDTHCOLICON\">&nbsp;</th><th>$Message[21]</th><th width=\"80\">$Message[111]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th></tr>\n";
 
15779
"<tr bgcolor=\"#$color_TableBGRowTitle\"><th width=\"$WIDTHCOLICON\">&nbsp;</th><th>$Message[21]</th><th width=\"80\">$Message[111]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[56]</th><th bgcolor=\"#$color_p\" width=\"80\">$Message[15]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th><th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th></tr>\n";
15442
15780
        my $total_h = 0;
 
15781
        my $total_p = 0;
15443
15782
        my $count = 0;
15444
15783
        foreach my $key (@keylist) {
15445
 
                my $p = '&nbsp;';
 
15784
                my $p_h = '&nbsp;';
 
15785
                my $p_p = '&nbsp;';
15446
15786
                if ($Totalh) {
15447
 
                        $p = int( $new_browser_h{$key} / $Totalh * 1000 ) / 10;
15448
 
                        $p = "$p %";
 
15787
                        $p_h = int( $new_browser_h{$key} / $Totalh * 1000 ) / 10;
 
15788
                        $p_h = "$p_h %";
 
15789
                }
 
15790
                if ($Totalp) {
 
15791
                        $p_p = int( $new_browser_p{$key} / $Totalp * 1000 ) / 10;
 
15792
                        $p_p = "$p_p %";
15449
15793
                }
15450
15794
                if ( $key eq 'Unknown' ) {
15451
15795
                        print "<tr><td"
15452
15796
                          . ( $count ? "" : " width=\"$WIDTHCOLICON\"" )
15453
15797
                          . "><img src=\"$DirIcons\/browser\/unknown.png\""
15454
15798
                          . AltTitle("")
15455
 
                          . " /></td><td class=\"aws\"><span style=\"color: #$color_other\">$Message[0]</span></td><td width=\"80\">?</td><td>".Format_Number($_browser_h{$key})."</td><td>$p</td></tr>\n";
 
15799
                          . " /></td><td class=\"aws\"><span style=\"color: #$color_other\">$Message[0]</span></td><td width=\"80\">?</td>"
 
15800
                          . "<td>".Format_Number($_browser_p{$key})."</td><td>$p_p</td>"
 
15801
                          . "<td>".Format_Number($_browser_h{$key})."</td><td>$p_h</td></tr>\n";
15456
15802
                }
15457
15803
                else {
15458
15804
                        my $keywithoutcumul = $key;
15478
15824
                                ? "<b>$Message[112]</b>"
15479
15825
                                : "$Message[113]"
15480
15826
                          )
15481
 
                          . "</td><td>".Format_Number($new_browser_h{$key})."</td><td>$p</td></tr>\n";
 
15827
                          . "</td><td>".Format_Number($new_browser_p{$key})."</td><td>$p_p</td><td>".Format_Number($new_browser_h{$key})."</td><td>$p_h</td></tr>\n";
15482
15828
                }
15483
15829
                $total_h += $new_browser_h{$key};
 
15830
                $total_p += $new_browser_p{$key};
15484
15831
                $count++;
15485
15832
        }
15486
15833
        if ($Debug) {
15487
15834
                debug( "Total real / shown : $Totalh / $total_h", 2 );
15488
15835
        }
15489
15836
        my $rest_h = $Totalh - $total_h;
 
15837
        my $rest_p = $Totalp - $total_p;
15490
15838
        if ( $rest_h > 0 ) {
15491
 
                my $p;
15492
 
                if ($Totalh) { $p = int( $rest_h / $Totalh * 1000 ) / 10; }
 
15839
                my $p_p = 0.0;
 
15840
                my $p_h;
 
15841
                if ($Totalh) { $p_h = int( $rest_h / $Totalh * 1000 ) / 10; }
 
15842
                if ($Totalp) { $p_p = int( $rest_p / $Totalp * 1000 ) / 10; }
15493
15843
                print "<tr>";
15494
15844
                print "<td>&nbsp;</td>";
15495
15845
                print
15496
 
"<td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]</span></td><td>&nbsp;</td><td>$rest_h</td>";
15497
 
                        print "<td>$p %</td></tr>\n";
15498
 
                }
15499
 
                &tab_end();
 
15846
"<td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]</span></td><td>&nbsp;</td><td>$rest_p</td>";
 
15847
                print "<td>$p_p %</td><td>$rest_h</td><td>$p_h %</td></tr>\n";
 
15848
        }
 
15849
        &tab_end();
15500
15850
}
15501
15851
 
15502
15852
#------------------------------------------------------------------------------
15581
15931
                  ? $_from_h[$_]
15582
15932
                  : 0;
15583
15933
        }
15584
 
        &tab_head( $Message[36], 19, 0, 'referer' );
 
15934
 
 
15935
    my $title = "$Message[36]";
 
15936
 
 
15937
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
15938
       # extend the title to include the added link
 
15939
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
15940
               "$AddLinkToExternalCGIWrapper" . "?section=ORIGIN&baseName=$DirData/$PROG"
 
15941
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
15942
           . "&siteConfig=$SiteConfig" )
 
15943
           . "\"$NewLinkTarget>$Message[179]</a>");
 
15944
    }
 
15945
        
 
15946
        &tab_head( $title, 19, 0, 'referer' );
15585
15947
        my @p_p = ( 0, 0, 0, 0, 0, 0 );
15586
15948
        if ( $Totalp > 0 ) {
15587
15949
                $p_p[0] = int( $_from_p[0] / $Totalp * 1000 ) / 10;
16065
16427
        if ($Debug) { debug( "ShowHTTPErrorsStats", 2 ); }
16066
16428
        print "$Center<a name=\"errors\">&nbsp;</a><br />\n";
16067
16429
        my $title = "$Message[32]";
 
16430
        
 
16431
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
16432
       # extend the title to include the added link
 
16433
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
16434
               "$AddLinkToExternalCGIWrapper" . "?section=ERRORS&baseName=$DirData/$PROG"
 
16435
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
16436
           . "&siteConfig=$SiteConfig" )
 
16437
           . "\"$NewLinkTarget>$Message[179]</a>");
 
16438
    }
 
16439
                
16068
16440
        &tab_head( "$title", 19, 0, 'errors' );
16069
16441
        
16070
16442
        &BuildKeyList( $MaxRowsInHTMLOutput, 1, \%_errors_h, \%_errors_h );
16177
16549
        if ($Debug) { debug( "ShowClusterStats", 2 ); }
16178
16550
        print "$Center<a name=\"clusters\">&nbsp;</a><br />\n";
16179
16551
        my $title = "$Message[155]";
 
16552
        
 
16553
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
16554
       # extend the title to include the added link
 
16555
           $title .= " &nbsp; - &nbsp; <a href=\"" . (XMLEncode(
 
16556
               "$AddLinkToExternalCGIWrapper" . "?section=CLUSTER&baseName=$DirData/$PROG"
 
16557
           . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
16558
           . "&siteConfig=$SiteConfig" )
 
16559
           . "\"$NewLinkTarget>$Message[179]</a>");
 
16560
    }
 
16561
                
16180
16562
        &tab_head( "$title", 19, 0, 'clusters' );
16181
16563
        
16182
16564
        &BuildKeyList( $MaxRowsInHTMLOutput, 1, \%_cluster_p, \%_cluster_p );
16286
16668
                : "$StaticLinks.allextra$extranum.$StaticExt"
16287
16669
          )
16288
16670
          . "\"$NewLinkTarget>$Message[80]</a>";
 
16671
          
 
16672
    if ( $AddLinkToExternalCGIWrapper && ($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks) ) {
 
16673
        print "&nbsp; - &nbsp; <a href=\""
 
16674
          . (XMLEncode(
 
16675
               "$AddLinkToExternalCGIWrapper" . "?section=EXTRA_$extranum&baseName=$DirData/$PROG"
 
16676
            . "&month=$MonthRequired&year=$YearRequired&day=$DayRequired"
 
16677
            . "&sectionTitle=$ExtraName[$extranum]&siteConfig=$SiteConfig" )
 
16678
            . "\"$NewLinkTarget>$Message[179]</a>");
 
16679
    }
 
16680
  
16289
16681
        print "</th>";
16290
16682
 
16291
16683
        if ( $ExtraStatTypes[$extranum] =~ m/P/i ) {
18321
18713
                                if ( $ValidHTTPCodes{ $field[$pos_code] } ) {    # Code is valid
18322
18714
                                        if ( int($field[$pos_code]) == 304 && $pos_size>0) { $field[$pos_size] = 0; }
18323
18715
                                        # track downloads
18324
 
                                        if (int($field[$pos_code]) == 200 && $MimeHashLib{$extension}[1] eq 'd'){
 
18716
                                        if (int($field[$pos_code]) == 200 && $MimeHashLib{$extension}[1] eq 'd' && $urlwithnoquery !~ /robots.txt$/ )  # We track download if $MimeHashLib{$extension}[1] = 'd'
 
18717
                                        {
18325
18718
                                                $_downloads{$urlwithnoquery}->{'AWSTATS_HITS'}++;
18326
18719
                                                $_downloads{$urlwithnoquery}->{'AWSTATS_SIZE'} += ($pos_size>0 ? int($field[$pos_size]) : 0);
18327
18720
                                                if ($Debug) { debug( " New download detected: '$urlwithnoquery'", 2 ); }
18995
19388
                                                        && $UserAgent !~ /$regnotfirefox/o )
18996
19389
                                                {
18997
19390
                                                        $_browser_h{"firefox$1"}++;
 
19391
                                                        if ($PageBool) { $_browser_p{"firefox$1"}++; }
18998
19392
                                                        $TmpBrowser{$UserAgent} = "firefox$1";
18999
19393
                                                }
19000
19394
 
19001
19395
                                                # Opera ?
19002
19396
                                                elsif ( $UserAgent =~ /$regveropera/o ) {
19003
19397
                                                        $_browser_h{"opera$1"}++;
 
19398
                                                        if ($PageBool) { $_browser_p{"opera$1"}++; }
19004
19399
                                                        $TmpBrowser{$UserAgent} = "opera$1";
19005
19400
                                                }
19006
19401
 
19007
19402
                                                # Chrome ?
19008
19403
                                                elsif ( $UserAgent =~ /$regverchrome/o ) {
19009
19404
                                                        $_browser_h{"chrome$1"}++;
 
19405
                                                        if ($PageBool) { $_browser_p{"chrome$1"}++; }
19010
19406
                                                        $TmpBrowser{$UserAgent} = "chrome$1";
19011
19407
                                                }
19012
19408
 
19019
19415
                                                                $safariver = $1;
19020
19416
                                                        }
19021
19417
                                                        $_browser_h{"safari$safariver"}++;
 
19418
                                                        if ($PageBool) { $_browser_p{"safari$safariver"}++; }
19022
19419
                                                        $TmpBrowser{$UserAgent} = "safari$safariver";
19023
19420
                                                }
19024
19421
 
19025
19422
                                                # Konqueror ?
19026
19423
                                                elsif ( $UserAgent =~ /$regverkonqueror/o ) {
19027
19424
                                                        $_browser_h{"konqueror$1"}++;
 
19425
                                                        if ($PageBool) { $_browser_p{"konqueror$1"}++; }
19028
19426
                                                        $TmpBrowser{$UserAgent} = "konqueror$1";
19029
19427
                                                }
19030
19428
 
19031
19429
                                                # Subversion ?
19032
19430
                                                elsif ( $UserAgent =~ /$regversvn/o ) {
19033
19431
                                                        $_browser_h{"svn$1"}++;
 
19432
                                                        if ($PageBool) { $_browser_p{"svn$1"}++; }
19034
19433
                                                        $TmpBrowser{$UserAgent} = "svn$1";
19035
19434
                                                }
19036
19435
 
19039
19438
                                                        && $UserAgent !~ /$regnotie/o )
19040
19439
                                                {
19041
19440
                                                        $_browser_h{"msie$2"}++;
 
19441
                                                        if ($PageBool) { $_browser_p{"msie$2"}++; }
19042
19442
                                                        $TmpBrowser{$UserAgent} = "msie$2";
19043
19443
                                                }
19044
19444
 
19045
19445
                                                # Netscape 6.x, 7.x ... ? (must be at end of test)
19046
19446
                                                elsif ( $UserAgent =~ /$regvernetscape/o ) {
19047
19447
                                                        $_browser_h{"netscape$1"}++;
 
19448
                                                        if ($PageBool) { $_browser_p{"netscape$1"}++; }
19048
19449
                                                        $TmpBrowser{$UserAgent} = "netscape$1";
19049
19450
                                                }
19050
19451
 
19053
19454
                                                        && $UserAgent !~ /$regnotnetscape/o )
19054
19455
                                                {
19055
19456
                                                        $_browser_h{"netscape$2"}++;
 
19457
                                                        if ($PageBool) { $_browser_p{"netscape$2"}++; }
19056
19458
                                                        $TmpBrowser{$UserAgent} = "netscape$2";
19057
19459
                                                }
19058
19460
 
19066
19468
 
19067
19469
                                                                   # TODO If browser is in a family, use version
19068
19470
                                                                        $_browser_h{"$browser"}++;
 
19471
                                                                        if ($PageBool) { $_browser_p{"$browser"}++; }
19069
19472
                                                                        $TmpBrowser{$UserAgent} = "$browser";
19070
19473
                                                                        $found = 1;
19071
19474
                                                                        last;
19076
19479
                                                # Unknown browser ?
19077
19480
                                                if ( !$found ) {
19078
19481
                                                        $_browser_h{'Unknown'}++;
 
19482
                                                        if ($PageBool) { $_browser_p{'Unknown'}++; }
19079
19483
                                                        $TmpBrowser{$UserAgent} = 'Unknown';
19080
19484
                                                        my $newua = $UserAgent;
19081
19485
                                                        $newua =~ tr/\+ /__/;
19084
19488
                                        }
19085
19489
                                        else {
19086
19490
                                                $_browser_h{$uabrowser}++;
 
19491
                                                if ($PageBool) { $_browser_p{$uabrowser}++; }
19087
19492
                                                if ( $uabrowser eq 'Unknown' ) {
19088
19493
                                                        my $newua = $UserAgent;
19089
19494
                                                        $newua =~ tr/\+ /__/;
19107
19512
                                                        if ( $UserAgent =~ /$_/ ) {
19108
19513
                                                                my $osid = $OSHashID{ &UnCompileRegex($_) };
19109
19514
                                                                $_os_h{"$osid"}++;
 
19515
                                                                if ($PageBool) { $_os_p{"$osid"}++; }
19110
19516
                                                                $TmpOS{$UserAgent} = "$osid";
19111
19517
                                                                $found = 1;
19112
19518
                                                                last;
19116
19522
                                                # Unknown OS ?
19117
19523
                                                if ( !$found ) {
19118
19524
                                                        $_os_h{'Unknown'}++;
 
19525
                                                        if ($PageBool) { $_os_p{'Unknown'}++; }
19119
19526
                                                        $TmpOS{$UserAgent} = 'Unknown';
19120
19527
                                                        my $newua = $UserAgent;
19121
19528
                                                        $newua =~ tr/\+ /__/;
19124
19531
                                        }
19125
19532
                                        else {
19126
19533
                                                $_os_h{$uaos}++;
 
19534
                                                if ($PageBool) {
 
19535
                                                        $_os_p{$uaos}++;
 
19536
                                                }
19127
19537
                                                if ( $uaos eq 'Unknown' ) {
19128
19538
                                                        my $newua = $UserAgent;
19129
19539
                                                        $newua =~ tr/\+ /__/;
19137
19547
                        else {
19138
19548
                                $_browser_h{'Unknown'}++;
19139
19549
                                $_os_h{'Unknown'}++;
 
19550
                                if ($PageBool) {
 
19551
                                        $_browser_p{'Unknown'}++;
 
19552
                                        $_os_p{'Unknown'}++;
 
19553
                                }
19140
19554
                        }
19141
19555
 
19142
19556
                        # Analyze: Referer
20385
20799
                        &HTMLShowURLDetail();
20386
20800
                }
20387
20801
                if ( $HTMLOutput{'unknownos'} ) {
20388
 
                        &HTMLShowOSUnknown();
 
20802
                        &HTMLShowOSUnknown($NewLinkTarget);
20389
20803
                }
20390
20804
                if ( $HTMLOutput{'unknownbrowser'} ) {
20391
 
                        &HTMLShowBrowserUnknown();
 
20805
                        &HTMLShowBrowserUnknown($NewLinkTarget);
20392
20806
                }
20393
20807
                if ( $HTMLOutput{'osdetail'} ) {
20394
20808
                        &HTMLShowOSDetail();
20397
20811
                        &HTMLShowBrowserDetail();
20398
20812
                }
20399
20813
                if ( $HTMLOutput{'refererse'} ) {
20400
 
                        &HTMLShowReferers();
 
20814
                        &HTMLShowReferers($NewLinkTarget);
20401
20815
                }
20402
20816
                if ( $HTMLOutput{'refererpages'} ) {
20403
 
                        &HTMLShowRefererPages();
 
20817
                        &HTMLShowRefererPages($NewLinkTarget);
20404
20818
                }
20405
20819
                if ( $HTMLOutput{'keyphrases'} ) {
20406
 
                        &HTMLShowKeyPhrases();
 
20820
                        &HTMLShowKeyPhrases($NewLinkTarget);
20407
20821
                }
20408
20822
                if ( $HTMLOutput{'keywords'} ) {
20409
 
                        &HTMLShowKeywords();
 
20823
                        &HTMLShowKeywords($NewLinkTarget);
20410
20824
                }
20411
20825
                if ( $HTMLOutput{'downloads'} ) {
20412
20826
                        &HTMLShowDownloads();
20506
20920
                # BY DAY OF WEEK
20507
20921
                #-------------------------
20508
20922
                if ($ShowDaysOfWeekStats) {
20509
 
                        &HTMLMainDaysofWeek($firstdaytocountaverage, $lastdaytocountaverage);
 
20923
                        &HTMLMainDaysofWeek($firstdaytocountaverage, $lastdaytocountaverage, $NewLinkParams, $NewLinkTarget);
20510
20924
                }
20511
20925
 
20512
20926
                # BY HOUR
20513
20927
                #----------------------------
20514
20928
                if ($ShowHoursStats) {
20515
 
                        &HTMLMainHours();
 
20929
                        &HTMLMainHours($NewLinkParams, $NewLinkTarget);
20516
20930
                }
20517
20931
 
20518
20932
                print "\n<a name=\"who\">&nbsp;</a>\n\n";
20570
20984
                # BY FILE TYPE
20571
20985
                #-------------------------
20572
20986
                if ($ShowFileTypesStats) {
20573
 
                        &HTMLMainFileType();
 
20987
                        &HTMLMainFileType($NewLinkParams, $NewLinkTarget);
20574
20988
                }
20575
20989
 
20576
20990
                # BY FILE SIZE