summaryrefslogtreecommitdiffstats
path: root/usr/local/www/includes/functions.inc.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-12-23 14:57:16 +0000
committerErmal <eri@pfsense.org>2013-12-23 14:57:16 +0000
commit66cc4d430accd8cf970b55fb9eb513af9601b8b6 (patch)
tree6dc1b1588840ea061ef381723a7aaae7aac920da /usr/local/www/includes/functions.inc.php
parent0b5d55b7490e56013010cba0f1367996b5f07bb3 (diff)
downloadpfsense-66cc4d430accd8cf970b55fb9eb513af9601b8b6.zip
pfsense-66cc4d430accd8cf970b55fb9eb513af9601b8b6.tar.gz
Correct displaying states status and avoid divison by zero due to wrong data collected
Diffstat (limited to 'usr/local/www/includes/functions.inc.php')
-rw-r--r--usr/local/www/includes/functions.inc.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php
index 198da00..0c66f4a 100644
--- a/usr/local/www/includes/functions.inc.php
+++ b/usr/local/www/includes/functions.inc.php
@@ -145,8 +145,10 @@ function get_pfstate($percent=false) {
if (preg_match("/([0-9]+)/", $curentries, $matches)) {
$curentries = $matches[1];
}
+ if (!is_number($curentries))
+ $curentries = 0;
if ($percent)
- if ($maxstates > 0)
+ if (intval($maxstates) > 0)
return round(($curentries / $maxstates) * 100, 0);
else
return "NA";
OpenPOWER on IntegriCloud