Index: trunk/bin/alternc_stats_web.php
===================================================================
--- trunk/bin/alternc_stats_web.php	(revision 1396)
+++ trunk/bin/alternc_stats_web.php	(revision 1397)
@@ -72,4 +72,19 @@
 }
 
+$months=array("Jan"=>"01","Feb"=>"02","Mar"=>"03","Apr"=>"04","May"=>"05","Jun"=>"06","Jul"=>"07","Aug"=>"08","Sep"=>"09","Oct"=>"10","Nov"=>"11","Dec"=>"12");
+
+/**
+ * match "escaped quotes" or "everything except quotes"
+ *
+ * this might represent a significant performance hit
+ */
+$noquote = '(?:(?:(?<=\\\)")|(?:[^"]))*';
+
+// Exemple de ligne apache : 
+// crawl18.dir.com - login [14/Jun/2004:06:38:47 +0200] "GET /modules/newbb?days=100 HTTP/1.0" 200 20156 "-" "Pompos/1.3 http://dir.com/pompos.html" 2 esperance-jeunes.org
+
+// this pattern should match it
+$pattern = '/^[^ ]* [^ ]* [^ ]* \\[([0-9]*)\\/([a-zA-Z]*)\\/([0-9]*):[0-9]*:[0-9]*:[0-9]* [^ ]* "'.$noquote.'" ([0-9-]*) ([0-9-]*) "'.$noquote.'" "'.$noquote.'" [0-9]* ([^ ]*)$/';
+
 $total_hits = $total_good = 0;
 
@@ -101,20 +116,4 @@
   $domstat=array(); // On stocke sous forme de clé "dom/day" => "hit or bandwith"
   $domuid=array();  // Cache des uids associés aux domaines.
-
-
-  $months=array("Jan"=>"01","Feb"=>"02","Mar"=>"03","Apr"=>"04","May"=>"05","Jun"=>"06","Jul"=>"07","Aug"=>"08","Sep"=>"09","Oct"=>"10","Nov"=>"11","Dec"=>"12");
-
-  /**
-   * match "escaped quotes" or "everything except quotes"
-   *
-   * this might represent a significant performance hit
-   */
-  $noquote = '(?:(?:(?<=\\\)")|(?:[^"]))*';
-
-  // Exemple de ligne apache : 
-  // crawl18.dir.com - login [14/Jun/2004:06:38:47 +0200] "GET /modules/newbb?days=100 HTTP/1.0" 200 20156 "-" "Pompos/1.3 http://dir.com/pompos.html" 2 esperance-jeunes.org
-
-  // this pattern should match it
-  $pattern = '/^[^ ]* [^ ]* [^ ]* \\[([0-9]*)\\/([a-zA-Z]*)\\/([0-9]*):[0-9]*:[0-9]*:[0-9]* [^ ]* "'.$noquote.'" ([0-9-]*) ([0-9-]*) "'.$noquote.'" "'.$noquote.'" [0-9]* ([^ ]*)$/';
 
   // parse a line at a time
@@ -162,4 +161,16 @@
 }
 
+if ($verbose) echo "\n$total_hits lines read total ($total_good good)\n";
+
+// check validity
+if ($full) {
+  list($res) = mysql_fetch_array(mysql_query("SELECT SUM(hit) FROM stat_http"));
+  if ($res == $total_good) {
+    echo "correct count: $res\n";
+  } else {
+    echo "difference between database hits and lines read: $res => $total_good\n";
+  }
+}
+
 // handy function to avoid a copy-paste
 function insert_lines($domstat, &$domuid) {
@@ -190,15 +201,3 @@
 }
 
-if ($verbose) echo "\n$total_hits lines read total ($total_good good)\n";
-
-// check validity
-if ($full) {
-  list($res) = mysql_fetch_array(mysql_query("SELECT SUM(hit) FROM stat_http"));
-  if ($res == $total_good) {
-    echo "correct count: $res\n";
-  } else {
-    echo "difference between database hits and lines read: $res => $total_good\n";
-  }
-}
-
 ?>
