From cf4ea0171e588fdc9d44beb705e379a20ecbd652 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 1 Jul 2014 19:43:27 +0200 Subject: Simplify code to bound integer values Suggested-by: Florian Pritz Signed-off-by: Lukas Fleischer --- web/html/pkgreq.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'web/html/pkgreq.php') diff --git a/web/html/pkgreq.php b/web/html/pkgreq.php index 156645a3..401b60c7 100644 --- a/web/html/pkgreq.php +++ b/web/html/pkgreq.php @@ -21,19 +21,13 @@ if (!isset($base_id)) { /* Sanitize paging variables. */ if (isset($_GET['O'])) { - $_GET['O'] = intval($_GET['O']); - if ($_GET['O'] < 0) - $_GET['O'] = 0; + $_GET['O'] = max(intval($_GET['O']), 0); } else { $_GET['O'] = 0; } if (isset($_GET["PP"])) { - $_GET["PP"] = intval($_GET["PP"]); - if ($_GET["PP"] < 50) - $_GET["PP"] = 50; - else if ($_GET["PP"] > 250) - $_GET["PP"] = 250; + $_GET["PP"] = bound(intval($_GET["PP"]), 50, 250); } else { $_GET["PP"] = 50; } -- cgit v1.2.3-24-g4f1b