diff --git a/html/includes/graphs/generic_bits.inc.php b/html/includes/graphs/generic_bits.inc.php
index b16cf840a..c3314b2d4 100644
--- a/html/includes/graphs/generic_bits.inc.php
+++ b/html/includes/graphs/generic_bits.inc.php
@@ -1,7 +1,7 @@
diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php
index f832e9d52..d5c4cdd90 100644
--- a/html/includes/graphs/graph.inc.php
+++ b/html/includes/graphs/graph.inc.php
@@ -19,6 +19,10 @@ $to = (isset($_GET['to']) ? $_GET['to'] : time());
if ($from < 0) { $from = $to + $from; }
+$period = $to - $from;
+
+$prev_from = $from - $period;
+
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', $_GET['type'], $graphtype);