From edaa7c5d66ef52eec1c15f79ae4034fc3e67b9b7 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 25 Oct 2012 10:29:39 -0400
Subject: [PATCH] - Fixed: FS#2502 - Problem in web traffic accounting for large integers - Added intval function from interface functions library to server system library.

---
 server/conf/awstats_index.php.master |   54 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/server/conf/awstats_index.php.master b/server/conf/awstats_index.php.master
index e0f185e..f7222c9 100644
--- a/server/conf/awstats_index.php.master
+++ b/server/conf/awstats_index.php.master
@@ -5,29 +5,39 @@
 
 if ($handle = opendir('.'))
 {
-	while(false !== ($file = readdir($handle)))
-	{
-		if (substr($file,0,1) != "." && is_dir($file))
-		{
-			$orderkey = substr($file,0,4).substr($file,5,2);
-			if (substr($file,5,2) < 10 ) $orderkey = substr($file,0,4)."0".substr($file,5,2);
-			$awprev[$orderkey] = $file;
+        while(false !== ($file = readdir($handle)))
+        {
+                if (substr($file,0,1) != "." && is_dir($file))
+                {
+                        $orderkey = substr($file,0,4).substr($file,5,2);
+                        if (substr($file,5,2) < 10 )
+                        {
+                                $orderkey = substr($file,0,4)."0".substr($file,5,2);
+                        }
+                        $awprev[$orderkey] = $file;
+                }
+        }
+
+        $month = date("n");
+        $year = date("Y");
+		
+        if (date("d") == 1)
+        {
+                $month = date("m")-1;
+                if (date("m") == 1)
+                {
+                        $year = date("Y")-1;
+                        $month = "12";
+                }
+        }
+
+        $current = $year.$month;
+		if ( $month < 10 ) {
+			$current = $year."0".$month;
 		}
-	}
-	$month = date("n");
-	$year = date("Y");
-	if (date("d") == 1)
-	{
-		$month = date("m")-1;
-		if (date("m") == 1)
-		{
-			$year = date("Y")-1;
-			$month = "12";
-		}
-	}
-	$current = $year.$month;
-	$awprev[$current] = $year."-".$month;
-	closedir($handle);
+		$awprev[$current] = $year."-".$month;
+
+		closedir($handle);
 }
 
 arsort($awprev);

--
Gitblit v1.9.1