'ar' => 'sa',
'sr' => 'cs'
);
-# TODO Remove this old array for an old way to detect Safari version
+
+# TODO Remove this old array for an old way to detect Safari version
%SafariBuildToVersion = (
'85' => '1.0',
'85.5' => '1.0',
print "</style>\n";
}
- # les scripts nécessaires pour trier avec Tablekit
- # print "<script type=\"text\/javascript\" src=\"/js/prototype.js\"><\/script>";
- # print "<script type=\"text\/javascript\" src=\"/js/fabtabulous.js\"><\/script>";
- # print "<script type=\"text\/javascript\" src=\"/js/mytablekit.js\"><\/script>";
-
+# les scripts nécessaires pour trier avec Tablekit
+# print "<script type=\"text\/javascript\" src=\"/js/prototype.js\"><\/script>";
+# print "<script type=\"text\/javascript\" src=\"/js/fabtabulous.js\"><\/script>";
+# print "<script type=\"text\/javascript\" src=\"/js/mytablekit.js\"><\/script>";
+
print "</head>\n\n";
if ( $FrameName ne 'index' ) {
print "<body style=\"margin-top: 0px\"";
foreach my $key ( values %val ) { $notsortedkeylist{$key} = 1; }
foreach my $key ( values %egal ) { $notsortedkeylist{$key} = 1; }
@keylist = ();
- @keylist =
- ( sort { ( $hashfororder->{$b} || 0 ) <=> ( $hashfororder->{$a} || 0 ) }
- keys %notsortedkeylist );
+ @keylist = (
+ sort { ( $hashfororder->{$b} || 0 ) <=> ( $hashfororder->{$a} || 0 ) }
+ keys %notsortedkeylist
+ );
if ($Debug) {
debug( " BuildKeyList End (keylist size=" . (@keylist) . ")", 3 );
}
. ">$Message[57]</th>";
}
if ( $ShowEMailSenders =~ /B/i ) {
- print "<th class=\"datasize\" rowspan=\"2\" bgcolor=\"#$color_k\" width=\"80\""
+ print
+"<th class=\"datasize\" rowspan=\"2\" bgcolor=\"#$color_k\" width=\"80\""
. Tooltip(5)
. ">$Message[75]</th>";
}
. ">$Message[57]</th>";
}
if ( $ShowEMailReceivers =~ /B/i ) {
- print "<th class=\"datasize\" rowspan=\"2\" bgcolor=\"#$color_k\" width=\"80\""
+ print
+"<th class=\"datasize\" rowspan=\"2\" bgcolor=\"#$color_k\" width=\"80\""
. Tooltip(5)
. ">$Message[75]</th>";
}
my $regverfirefox = qr/firefox\/([\d\.]*)/i;
my $regveropera = qr/opera\/([\d\.]*)/i;
my $regversafari = qr/safari\/([\d\.]*)/i;
- my $regversafariver = qr/version\/([\d\.]*)/i;
+ my $regversafariver = qr/version\/([\d\.]*)/i;
my $regverchrome = qr/chrome\/([\d\.]*)/i;
my $regverkonqueror = qr/konqueror\/([\d\.]*)/i;
my $regversvn = qr/svn\/([\d\.]*)/i;
# Loop on each log line
#
while ( $line = <LOG> ) {
+
+ # 20080525 BEGIN Patch to test if first char of $line = hex "00" then conclude corrupted with binary code
+ my $FirstHexChar;
+ $FirstHexChar = sprintf( "%02X", ord( substr( $line, 0, 1 ) ) );
+ if ( $FirstHexChar eq '00' ) {
+ $NbOfLinesCorrupted++;
+ if ($ShowCorrupted) {
+ print "Corrupted record line "
+ . ( $lastlinenb + $NbOfLinesParsed )
+ . " (record starts with hex 00; binary code): $line\n";
+ }
+ if ( $NbOfLinesParsed >= $NbOfLinesForCorruptedLog
+ && $NbOfLinesParsed == $NbOfLinesCorrupted )
+ {
+ error( "Format error", $line, $LogFile );
+ } # Exit with format error
+ next;
+ }
+ # 20080525 END
+
chomp $line;
$line =~ s/\r$//;
if ( $UpdateFor && $NbOfLinesParsed >= $UpdateFor ) { last; }
# Analyze: successful favicon (=> countedtraffic=1 if favicon)
#--------------------------------------------------
- if ($urlwithnoquery =~ /$regfavico/o)
- {
- if ($field[$pos_code] != 404) {
+ if ( $urlwithnoquery =~ /$regfavico/o ) {
+ if ( $field[$pos_code] != 404 ) {
$_misc_h{'AddToFavourites'}++;
}
$countedtraffic =
1; # favicon is a case that must not be counted anywhere else
$_time_nv_h[$hourrecord]++;
- if ($field[$pos_code] != 404) {
+ if ( $field[$pos_code] != 404 ) {
$_time_nv_k[$hourrecord] += int( $field[$pos_size] );
}
}
}
}
- # Analyze: Robot from "hit on robots.txt" file (=> countedtraffic=5 if robot)
- # -------------------------------------------------------------------------
+ # Analyze: Robot from "hit on robots.txt" file (=> countedtraffic=5 if robot)
+ # -------------------------------------------------------------------------
if ( !$countedtraffic ) {
if ( $urlwithnoquery =~ /$regrobot/o ) {
if ($Debug) { debug( " It's an unknown robot", 2 ); }
# Do DNS lookup
#--------------
my $Host = $field[$pos_host];
- my $HostResolved = ''; # HostResolved will be defined in next paragraf if countedtraffic is true
+ my $HostResolved = ''
+ ; # HostResolved will be defined in next paragraf if countedtraffic is true
if ( !$countedtraffic ) {
my $ip = 0;
}
elsif ( $DNSLookup == 1 ) {
- # Check in session cache (dynamic DNS cache file + session DNS cache)
+ # Check in session cache (dynamic DNS cache file + session DNS cache)
$HostResolved = $TmpDNSLookup{$Host};
if ( !$HostResolved ) {
if ( @SkipDNSLookupFor && &SkipDNSLookup($Host) ) {
my $found = 1;
# Firefox ?
- if ($UserAgent =~ /$regverfirefox/o
+ if ( $UserAgent =~ /$regverfirefox/o
&& $UserAgent !~ /$regnotfirefox/o )
{
$_browser_h{"firefox$1"}++;
}
# Safari ?
- elsif ($UserAgent =~ /$regversafari/o && $UserAgent !~ /$regnotsafari/o) {
- my $safariver=$SafariBuildToVersion{$1};
- if ($UserAgent =~ /$regversafariver/o)
- {
- $safariver = $1;
- }
- $_browser_h{"safari$safariver"}++;
- $TmpBrowser{$UserAgent}="safari$safariver";
- }
+ elsif ($UserAgent =~ /$regversafari/o
+ && $UserAgent !~ /$regnotsafari/o )
+ {
+ my $safariver = $SafariBuildToVersion{$1};
+ if ( $UserAgent =~ /$regversafariver/o ) {
+ $safariver = $1;
+ }
+ $_browser_h{"safari$safariver"}++;
+ $TmpBrowser{$UserAgent} = "safari$safariver";
+ }
# Konqueror ?
elsif ( $UserAgent =~ /$regverkonqueror/o ) {
}
if ( $ShowDomainsStats =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
}
print "<th> </th>";
print "</tr>\n";
}
if ( $ShowHostsStats =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
}
if ( $ShowHostsStats =~ /L/i ) {
print "<th width=\"120\">$Message[9]</th>";
}
if ( $ShowHostsStats =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
}
if ( $ShowHostsStats =~ /L/i ) {
print "<th width=\"120\">$Message[9]</th>";
}
if ( $ShowAuthenticatedUsers =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
}
if ( $ShowAuthenticatedUsers =~ /L/i ) {
print "<th width=\"120\">$Message[9]</th>";
}
if ( $ShowRobotsStats =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>";
}
if ( $ShowRobotsStats =~ /L/i ) {
print "<th width=\"120\">$Message[9]</th>";
}
if ( $ShowPagesStats =~ /B/i ) {
print
- "<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[106]</th>";
+"<th class=\"datasize\" bgcolor=\"#$color_k\" width=\"80\">$Message[106]</th>";
}
if ( $ShowPagesStats =~ /E/i ) {
print
\%_unknownrefererbrowser_l );
foreach my $key (@keylist) {
my $useragent = XMLEncode( CleanXSS($key) );
- print "<tr><td class=\"aws\">$useragent</td><td nowrap=\"nowrap\">"
+ print
+ "<tr><td class=\"aws\">$useragent</td><td nowrap=\"nowrap\">"
. Format_Date( $_unknownrefererbrowser_l{$key}, 1 )
. "</td></tr>\n";
$total_l += 1;
}
# Write records grouped in a browser family
- foreach
- my $family ( sort { $BrowsersFamily{$a} <=> $BrowsersFamily{$b} }
- keys %BrowsersFamily )
+ foreach my $family (
+ sort { $BrowsersFamily{$a} <=> $BrowsersFamily{$b} }
+ keys %BrowsersFamily
+ )
{
my $p = ' ';
if ($total_h) {