diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php index 4ed8234..f92c47b 100644 --- a/includes/tsmmonitor.php +++ b/includes/tsmmonitor.php @@ -23,9 +23,9 @@ /** * * tsmmonitor.php, TSM Monitor - * + * * TSM Monitor main class - * + * * @author Michael Clemens * @package tsmmonitor */ @@ -57,9 +57,9 @@ class TSMMonitor { /** - * TSMMonitor - * - * @param mixed $adodb + * TSMMonitor + * + * @param mixed $adodb * @access public * @return void */ @@ -131,8 +131,8 @@ class TSMMonitor { //Cleanup if ($_SESSION["from"] != $_GET['q']) { - $_SESSION['timemachine'] = ""; - $_SESSION['tabletype'] = ""; + $_SESSION['timemachine'] = ""; + $_SESSION['tabletype'] = ""; } // BEGIN Timemachine @@ -194,21 +194,23 @@ class TSMMonitor { if (($recordSet) || ($this->adodb->conn->ErrorNo() == 0)) { $total_rows = $recordSet->RecordCount($recordSet); - $this->max_pages = ceil($total_rows/$rows_per_page); + if ($total_rows > 0 ) { + $this->max_pages = ceil($total_rows/$rows_per_page); - if($this->page > $this->max_pages || $this->page <= 0) { - $this->page = 1; - } - $offset = $rows_per_page * ($this->page-1); - $endset = $offset + $rows_per_page; - $recordSet->Move($offset); + if($this->page > $this->max_pages || $this->page <= 0) { + $this->page = 1; + } + $offset = $rows_per_page * ($this->page-1); + $endset = $offset + $rows_per_page; + $recordSet->Move($offset); - while (($recordSet->CurrentRow() < $endset) && ($recordSet->CurrentRow() < $total_rows) && ($recordSet)) { - $recordArray{sizeof($recordArray)} = $recordSet->fields; - $recordSet->MoveNext(); - } - $recordSet->close(); - return($recordArray); + while (($recordSet->CurrentRow() < $endset) && ($recordSet->CurrentRow() < $total_rows) && ($recordSet)) { + $recordArray{sizeof($recordArray)} = $recordSet->fields; + $recordSet->MoveNext(); + } + $recordSet->close(); + } + return($recordArray); } else { echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; exit; @@ -351,7 +353,7 @@ class TSMMonitor { } foreach ($this->getTimestampsOfADay($_SESSION['timemachine']['date']) as $ts) { $ret .= "