From: eldy <>
Date: Sun, 8 Jul 2001 13:12:27 +0000 (+0000)
Subject: Add autoscale units for downloaded bytes
X-Git-Tag: AWSTATS_1_0~239
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a39e3fd3d37bd2177a67b091a754ef221cfcaee;p=thirdparty%2FAWStats.git
Add autoscale units for downloaded bytes
---
diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl
index 160ed94b..735ab3d8 100644
--- a/wwwroot/cgi-bin/awstats.pl
+++ b/wwwroot/cgi-bin/awstats.pl
@@ -11,7 +11,7 @@
# See README.TXT file for setup and benchmark informations.
# See COPYING.TXT file about AWStats GNU General Public License.
#-------------------------------------------------------
-# Algorithm SUMMARY
+# ALGORITHM SUMMARY
# Read config file
# If 'update'
# Get last history file name
@@ -40,7 +40,7 @@
# Defines
#-------------------------------------------------------
-# ---------- Init variables --------
+# ---------- Init variables (Variable $TmpHashxxx are not initialized) --------
($ArchiveFileName, $ArchiveLogRecords, $BarHeight, $BarWidth,
$DIR, $DNSLookup, $DefaultFile, $DirCgi, $DirData,
$DirIcons, $Extension, $FileConfig, $FileSuffix, $FirstTime,
@@ -60,9 +60,9 @@ $bredde_v, $color_Background, $color_TableBG, $color_TableBGRowTitle,
$color_TableBGTitle, $color_TableBorder, $color_TableRowTitle,
$color_TableTitle, $color_h, $color_k, $color_link, $color_p, $color_s, $color_v,
$color_w, $count, $date, $daycon, $endmonth, $found, $foundrobot,
-$h, $hourcon, $hr, $internal_link, $ix, $keep, $key, $kilo, $lien, $line,
+$h, $hourcon, $hr, $internal_link, $ix, $keep, $key, $lien, $line,
$max, $max_h, $max_k, $max_p, $max_v, $mincon, $monthcon, $monthfile, $monthix,
-$monthtoprocess, $nameicon, $new, $nompage, $p, $page, $param,
+$monthtoprocess, $nameicon, $new, $nompage, $p, $param,
$paramtoexclude, $rest, $rest_h, $rest_k, $rest_p,
$tab_titre, $total_h, $total_k, $total_p,
$word, $yearcon, $yearfile, $yearmonthfile, $yeartoprocess) = ();
@@ -81,7 +81,7 @@ $word, $yearcon, $yearfile, $yearmonthfile, $yeartoprocess) = ();
%MonthBytes = %MonthHits = %MonthPages = %MonthUnique = %MonthVisits =
%listofyears = %monthlib = %monthnum = ();
-$VERSION="2.5 (build 34)";
+$VERSION="2.5 (build 35)";
$Lang=0;
# Default value
@@ -705,6 +705,7 @@ DIV { font: 12px arial,verdana,helvetica; text-align:justify; }
";
print "\n\n";
print "
\n";
+ &Init_HashArray; # Should be useless (to avoid problem with mod_perl that keep variables in memory).
}
@@ -1076,7 +1077,8 @@ sub Check_Config {
if ($message[72] eq "") { $message[72]="Navigation"; }
if ($message[73] eq "") { $message[73]="Day statistics"; }
if ($message[74] eq "") { $message[74]="Update now"; }
- if ($message[75] eq "") { $message[75]="Last update"; }
+ if ($message[75] eq "") { $message[75]="Bytes"; }
+ if ($message[76] eq "") { $message[76]="Last update"; }
}
#--------------------------------------------------------------------
@@ -1224,7 +1226,8 @@ sub Read_History_File {
}
#--------------------------------------------------------------------
-# Input: year,month
+# Function: Show flags for 5 major languages
+# Input: Year, Month
#--------------------------------------------------------------------
sub Save_History_File {
&debug("Call to Save_History_File [$_[0],$_[1]]");
@@ -1238,20 +1241,18 @@ sub Save_History_File {
print HISTORYTMP "BEGIN_DOMAIN\n";
foreach $key (keys %_domener_h) {
- $page=$_domener_p{$key};$kilo=$_domener_k{$key};
- if ($page == "") {$page=0;}
- if ($kilo == "") {$kilo=0;}
- print HISTORYTMP "$key $page $_domener_h{$key} $kilo\n"; next;
- }
+ my $page=$_domener_p{$key}; if ($page == "") {$page=0;}
+ my $bytes=$_domener_k{$key}; if ($bytes == "") {$bytes=0;}
+ print HISTORYTMP "$key $page $_domener_h{$key} $bytes\n"; next;
+ }
print HISTORYTMP "END_DOMAIN\n";
print HISTORYTMP "BEGIN_VISITOR\n";
foreach $key (keys %_hostmachine_h) {
- $page=$_hostmachine_p{$key};$kilo=$_hostmachine_k{$key};
- if ($page == "") {$page=0;}
- if ($kilo == "") {$kilo=0;}
- print HISTORYTMP "$key $page $_hostmachine_h{$key} $kilo $_hostmachine_l{$key}\n"; next;
- }
+ my $page=$_hostmachine_p{$key}; if ($page == "") {$page=0;}
+ my $bytes=$_hostmachine_k{$key}; if ($bytes == "") {$bytes=0;}
+ print HISTORYTMP "$key $page $_hostmachine_h{$key} $bytes $_hostmachine_l{$key}\n"; next;
+ }
print HISTORYTMP "END_VISITOR\n";
print HISTORYTMP "BEGIN_UNKNOWNIP\n";
@@ -1367,6 +1368,18 @@ sub Show_Flag_Links {
}
}
+#------------------------------------------------------------------------------
+# Function: Format value in bytes in a string (Bytes, Kb, Mb, Gb)
+# Input: bytes
+#------------------------------------------------------------------------------
+sub Format_Bytes {
+ my $bytes = $_[0];
+ my $fudge = 1;
+ if ($bytes >= $fudge * exp(3*log(1024))) { return sprintf("%.2f", $bytes/exp(3*log(1024)))." Gb"; }
+ if ($bytes >= $fudge * exp(2*log(1024))) { return sprintf("%.2f", $bytes/exp(2*log(1024)))." Mb"; }
+ if ($bytes >= $fudge * exp(1*log(1024))) { return sprintf("%.2f", $bytes/exp(1*log(1024)))." $message[44]"; }
+ return "$bytes Bytes";
+}
#-------------------------------------------------------
@@ -2353,7 +2366,7 @@ print "$CENTER
";
print "";
print "| $message[7]: | $SiteToAnalyze |
";
-print "| $message[75]: | ";
+print "| $message[76]: | ";
foreach $key (keys %LastUpdate) { if ($LastUpdate < $LastUpdate{$key}) { $choosedkey=$key; $LastUpdate = $LastUpdate{$key}; } }
$yearcon=substr($LastUpdate,0,4);$monthcon=substr($LastUpdate,4,2);$daycon=substr($LastUpdate,6,2);$hourcon=substr($LastUpdate,8,2);$mincon=substr($LastUpdate,10,2);
if ($LastUpdate != 0) { print "$daycon $monthlib{$monthcon} $yearcon - $hourcon:$mincon "; }
@@ -2438,10 +2451,9 @@ print " | $message[11] | ";
print "$message[56] | ";
print "$message[57] | ";
-print "$message[44] | ";
-$kilo=int($TotalBytes/1024*100)/100;
-print "$TotalVisits | $TotalUnique ($RatioHosts $message[52]) | $TotalPages ($RatioPages ".lc $message[56]."/".lc $message[12].") | ";
-print "$TotalHits ($RatioHits ".lc $message[57]."/".lc $message[12].") | $kilo $message[44] ($RatioBytes $message[44]/".lc $message[12].") | \n";
+print " | $message[75] |
";
+print "$TotalVisits | $TotalUnique ($RatioHosts $message[52]) | $TotalPages ($RatioPages ".lc($message[56]."/".$message[12]).") | ";
+print "$TotalHits ($RatioHits ".lc($message[57]."/".$message[12]).") | ".Format_Bytes($TotalBytes)." ($RatioBytes $message[44]/".lc($message[12]).") |
\n";
print "";
# Show monthly stats
print "";
@@ -2463,14 +2475,13 @@ for ($ix=1; $ix<=12; $ix++) {
if ($max_h > 0) { $bredde_p=$MonthPages{$YearRequired.$monthix}/$max_h*$BarHeight/2; }
if ($max_h > 0) { $bredde_h=$MonthHits{$YearRequired.$monthix}/$max_h*$BarHeight/2; }
if ($max_k > 0) { $bredde_k=$MonthBytes{$YearRequired.$monthix}/$max_k*$BarHeight/2; }
- $kilo=int(($MonthBytes{$YearRequired.$monthix}/1024)*100)/100;
print "";
print " ";
print " ";
print " ";
print " ";
print " ";
- print " ";
+ print " ";
print " | \n";
}
print "";
@@ -2514,11 +2525,10 @@ for ($ix=$MaxNbOfDays-1; $ix>=0; $ix--) {
if ($max_h > 0) { $bredde_p=$DayPages{$oldyear.$oldmonth.$oldday}/$max_h*$BarHeight/2; }
if ($max_h > 0) { $bredde_h=$DayHits{$oldyear.$oldmonth.$oldday}/$max_h*$BarHeight/2; }
if ($max_k > 0) { $bredde_k=$DayBytes{$oldyear.$oldmonth.$oldday}/$max_k*$BarHeight/2; }
- $kilo=int(($DayBytes{$oldyear.$oldmonth.$oldday}/1024)*100)/100;
print "";
print " ";
print " ";
- print " ";
+ print " ";
print " | \n";
}
print " ";
@@ -2536,12 +2546,13 @@ print " ";
print "
\n";
+
# BY COUNTRY/DOMAIN
#---------------------------
print "$CENTER ";
$tab_titre="$message[25]";
&tab_head;
-print "| $message[17] | Code | $message[56] | $message[57] | $message[44] | | \n";
+print "| $message[17] | Code | $message[56] | $message[57] | $message[75] | | \n";
if ($SortDir<0) { $max_h=$_domener_h{$sortdomains_h[0]}; }
else { $max_h=$_domener_h{$sortdomains_h[$#sortdomains_h]}; }
if ($SortDir<0) { $max_k=$_domener_k{$sortdomains_k[0]}; }
@@ -2552,18 +2563,17 @@ foreach $key (@sortdomains_p) {
if ($max_h > 0) { $bredde_p=$BarWidth*$_domener_p{$key}/$max_h+1; } # use max_h to enable to compare pages with hits
if ($max_h > 0) { $bredde_h=$BarWidth*$_domener_h{$key}/$max_h+1; }
if ($max_k > 0) { $bredde_k=$BarWidth*$_domener_k{$key}/$max_k+1; }
- $kilo=int(($_domener_k{$key}/1024)*100)/100;
if ($key eq "ip") {
print " | $message[0] | $key | ";
}
else {
print "  | $DomainsHash{$key} | $key | ";
}
- print "$_domener_p{$key} | $_domener_h{$key} | $kilo | ";
+ print "$_domener_p{$key} | $_domener_h{$key} | ".Format_Bytes($_domener_k{$key})." | ";
print "";
print "![\"$message[56]: \"$message[56]:](\"$DirIcons\/other\/$BarImageHorizontal_p\") \n";
print "![\"$message[57]: \"$message[57]:](\"$DirIcons\/other\/$BarImageHorizontal_h\") \n";
- print " ";
+ print " ";
print " | \n";
$total_p += $_domener_p{$key};
$total_h += $_domener_h{$key};
@@ -2579,12 +2589,11 @@ if ($rest_p > 0) { # All other domains (known or not)
if ($max_h > 0) { $bredde_p=$BarWidth*$rest_p/$max_h+1; } # use max_h to enable to compare pages with hits
if ($max_h > 0) { $bredde_h=$BarWidth*$rest_h/$max_h+1; }
if ($max_k > 0) { $bredde_k=$BarWidth*$rest_k/$max_k+1; }
- $kilo=int(($rest_k/1024)*100)/100;
- print "| $message[2] | $rest_p | $rest_h | $kilo | \n";
+ print " | $message[2] | $rest_p | $rest_h | ".Format_Bytes($rest_k)." | \n";
print "";
print "![\"$message[56]: \"$message[56]:](\"$DirIcons\/other\/$BarImageHorizontal_p\") \n";
print "![\"$message[57]: \"$message[57]:](\"$DirIcons\/other\/$BarImageHorizontal_h\") \n";
- print " ";
+ print " ";
print " | \n";
}
&tab_end;
@@ -2595,13 +2604,12 @@ if ($rest_p > 0) { # All other domains (known or not)
print "$CENTER ";
$tab_titre="TOP $MaxNbOfHostsShown $message[55] $TotalHosts $message[26] ($TotalUnique $message[11])";
&tab_head;
-print "| $message[18] | $message[56] | $message[57] | $message[44] | $message[9] | \n";
+print "| $message[18] | $message[56] | $message[57] | $message[75] | $message[9] | \n";
$count=0;$total_p=0;$total_h=0;$total_k=0;
foreach $key (@sorthosts_p) {
if ($_hostmachine_h{$key}>=$MinHitHost) {
- $kilo=int(($_hostmachine_k{$key}/1024)*100)/100;
if ($key eq "Unknown") {
- print "| $message[1] | $_hostmachine_p{$key} | $_hostmachine_h{$key} | $kilo | $message[3] | \n";
+ print "| $message[1] | $_hostmachine_p{$key} | $_hostmachine_h{$key} | ".Format_Bytes($_hostmachine_k{$key})." | $message[3] | \n";
}
else {
$yearcon=substr($_hostmachine_l{$key},0,4);
@@ -2609,7 +2617,7 @@ foreach $key (@sorthosts_p) {
$daycon=substr($_hostmachine_l{$key},6,2);
$hourcon=substr($_hostmachine_l{$key},8,2);
$mincon=substr($_hostmachine_l{$key},10,2);
- print "| $key | $_hostmachine_p{$key} | $_hostmachine_h{$key} | $kilo | ";
+ print " | $key | $_hostmachine_p{$key} | $_hostmachine_h{$key} | ".Format_Bytes($_hostmachine_k{$key})." | ";
if ($daycon ne "") {
if ($Lang != 0) { print "$daycon/$monthcon/$yearcon - $hourcon:$mincon | "; }
else { print "$daycon $monthlib{$monthcon} $yearcon - $hourcon:$mincon | "; }
@@ -2629,8 +2637,7 @@ $rest_p=$TotalPages-$total_p;
$rest_h=$TotalHits-$total_h;
$rest_k=$TotalBytes-$total_k;
if ($rest_p > 0) { # All other visitors (known or not)
- $kilo=int(($rest_k/1024)*100)/100;
- print "| $message[2] | $rest_p | $rest_h | $kilo | | \n";
+ print "| $message[2] | $rest_p | $rest_h | ".Format_Bytes($rest_k)." | | \n";
}
&tab_end;
@@ -2680,11 +2687,10 @@ for ($ix=0; $ix<=23; $ix++) {
if ($max_h > 0) { $bredde_p=($BarHeight*$_time_p[$ix]/$max_h)+1; }
if ($max_h > 0) { $bredde_h=($BarHeight*$_time_h[$ix]/$max_h)+1; }
if ($max_k > 0) { $bredde_k=($BarHeight*$_time_k[$ix]/$max_k)+1; }
- $kilo=int(($_time_k[$ix]/1024)*100)/100;
print "";
print " ";
print " ";
- print " ";
+ print " ";
print " | \n";
}
print " |
\n";
diff --git a/wwwroot/cgi-bin/lang/awstats-cz.txt b/wwwroot/cgi-bin/lang/awstats-cz.txt
index feb91263..079f556d 100644
--- a/wwwroot/cgi-bin/lang/awstats-cz.txt
+++ b/wwwroot/cgi-bin/lang/awstats-cz.txt
@@ -75,3 +75,4 @@ message71=Pro
message72=Navigation
message73=Daily statistics
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-de.txt b/wwwroot/cgi-bin/lang/awstats-de.txt
index 2e7dfc1c..6fe1c4e4 100644
--- a/wwwroot/cgi-bin/lang/awstats-de.txt
+++ b/wwwroot/cgi-bin/lang/awstats-de.txt
@@ -74,3 +74,4 @@ message71=Dez
message72=
message73=Tag statistik
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-dk.txt b/wwwroot/cgi-bin/lang/awstats-dk.txt
index d80eb719..a0f6878f 100644
--- a/wwwroot/cgi-bin/lang/awstats-dk.txt
+++ b/wwwroot/cgi-bin/lang/awstats-dk.txt
@@ -73,4 +73,5 @@ message70=Nov
message71=Dec
message72=
message73=Dag statistikker
-message74=Opdater
\ No newline at end of file
+message74=Opdater
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-en.txt b/wwwroot/cgi-bin/lang/awstats-en.txt
index 99b3b7f1..9185391d 100644
--- a/wwwroot/cgi-bin/lang/awstats-en.txt
+++ b/wwwroot/cgi-bin/lang/awstats-en.txt
@@ -74,3 +74,5 @@ message71=Dec
message72=
message73=Day statistics
message74=Update now
+message75=Bytes
+message76=Last update
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-es.txt b/wwwroot/cgi-bin/lang/awstats-es.txt
index 64fd04df..0e577d0c 100644
--- a/wwwroot/cgi-bin/lang/awstats-es.txt
+++ b/wwwroot/cgi-bin/lang/awstats-es.txt
@@ -74,3 +74,4 @@ message71=Dic
message72=
message73=Dia estadísticas
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-fr.txt b/wwwroot/cgi-bin/lang/awstats-fr.txt
index 17525094..04606244 100644
--- a/wwwroot/cgi-bin/lang/awstats-fr.txt
+++ b/wwwroot/cgi-bin/lang/awstats-fr.txt
@@ -74,4 +74,5 @@ message71=D
message72=Navigation
message73=Statistiques par jour
message74=Mise à jour immédiate
-message75=Dernière mise à jour
+message75=Octets
+message76=Dernière mise à jour
diff --git a/wwwroot/cgi-bin/lang/awstats-gr.txt b/wwwroot/cgi-bin/lang/awstats-gr.txt
index f217f84a..6a75d63c 100644
--- a/wwwroot/cgi-bin/lang/awstats-gr.txt
+++ b/wwwroot/cgi-bin/lang/awstats-gr.txt
@@ -75,3 +75,4 @@ message71=
message72=
message73=Daily statistics
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-it.txt b/wwwroot/cgi-bin/lang/awstats-it.txt
index b899ca17..7ea8e751 100644
--- a/wwwroot/cgi-bin/lang/awstats-it.txt
+++ b/wwwroot/cgi-bin/lang/awstats-it.txt
@@ -74,3 +74,4 @@ message71=Dic
message72=
message73=Giorno statistiche
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-kr.txt b/wwwroot/cgi-bin/lang/awstats-kr.txt
index 1e93e24e..f73159fe 100644
--- a/wwwroot/cgi-bin/lang/awstats-kr.txt
+++ b/wwwroot/cgi-bin/lang/awstats-kr.txt
@@ -75,3 +75,4 @@ message71=12
message72=
message73=ÀÏÀÏ Åë°è
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-nl.txt b/wwwroot/cgi-bin/lang/awstats-nl.txt
index acd40928..dc205e3e 100644
--- a/wwwroot/cgi-bin/lang/awstats-nl.txt
+++ b/wwwroot/cgi-bin/lang/awstats-nl.txt
@@ -74,3 +74,4 @@ message71=Dec
message72=Navigation
message73=Dag statistieken
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-pl.txt b/wwwroot/cgi-bin/lang/awstats-pl.txt
index 037f1632..933a8e4b 100644
--- a/wwwroot/cgi-bin/lang/awstats-pl.txt
+++ b/wwwroot/cgi-bin/lang/awstats-pl.txt
@@ -75,3 +75,4 @@ message71=Grudzie
message72=
message73=Dzieñ Statystyki
message74=Update now
+message75=Bytes
\ No newline at end of file
diff --git a/wwwroot/cgi-bin/lang/awstats-pt.txt b/wwwroot/cgi-bin/lang/awstats-pt.txt
index 9387e3dc..ee1bdb24 100644
--- a/wwwroot/cgi-bin/lang/awstats-pt.txt
+++ b/wwwroot/cgi-bin/lang/awstats-pt.txt
@@ -74,3 +74,4 @@ message71=Dez
message72=
message73=Daily statistics
message74=Update now
+message75=Bytes
diff --git a/wwwroot/cgi-bin/lang/awstats-tt-en.txt b/wwwroot/cgi-bin/lang/awstats-tt-en.txt
index d961d97d..34b771da 100644
--- a/wwwroot/cgi-bin/lang/awstats-tt-en.txt
+++ b/wwwroot/cgi-bin/lang/awstats-tt-en.txt
@@ -14,7 +14,7 @@
This piece of data is provided as a reference only, since the number of "pages" viewed is often prefered for marketing purposes.
- This piece of information refers to the amount of data downloaded by all pages, images and files within your site measured in KBs.
+ This piece of information refers to the amount of data downloaded by all pages, images and files within your site.
#PROG# recognizes each access to your site after a search from the #SearchEnginesArray# most popular Internet Search Engines and Directories (such as Yahoo, Altavista, Lycos, Google, Voila, etc...).
diff --git a/wwwroot/cgi-bin/lang/awstats-tt-fr.txt b/wwwroot/cgi-bin/lang/awstats-tt-fr.txt
index ac9a0031..7202d783 100644
--- a/wwwroot/cgi-bin/lang/awstats-tt-fr.txt
+++ b/wwwroot/cgi-bin/lang/awstats-tt-fr.txt
@@ -14,7 +14,7 @@
Ce compteur est donné à titre indicatif, le compteur "pages" etant préféré.
- Nombre de kilo octets téléchargé lors des visites du site.
+ Nombre d'octets téléchargés lors des visites du site.
Il s agit aussi bien du volume de données du au chargement des pages et images que des fichiers téléchargés.
diff --git a/wwwroot/cgi-bin/lang/awstats-ua.txt b/wwwroot/cgi-bin/lang/awstats-ua.txt
index 79e6b8fe..8a03b607 100644
--- a/wwwroot/cgi-bin/lang/awstats-ua.txt
+++ b/wwwroot/cgi-bin/lang/awstats-ua.txt
@@ -75,3 +75,4 @@ message71=
message72=
message73=Ùîäåííà ñòàòèñòèêà
message74=Îíîâèòè
+message75=Bytes
\ No newline at end of file