summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-07-01 19:43:27 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-07-01 19:46:16 +0200
commitcf4ea0171e588fdc9d44beb705e379a20ecbd652 (patch)
treec06049077e9761a3961ab45d3b3d093c4f3cb472 /web/lib/pkgfuncs.inc.php
parenta48739508c8b9de9fb0af30b8b656c5f19378170 (diff)
downloadaurweb-cf4ea0171e588fdc9d44beb705e379a20ecbd652.tar.xz
Simplify code to bound integer values
Suggested-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r--web/lib/pkgfuncs.inc.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index f515864..7e65d09 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -519,22 +519,14 @@ function pkg_search_page($SID="") {
/* Sanitize paging variables. */
if (isset($_GET['O'])) {
- $_GET['O'] = intval($_GET['O']);
- if ($_GET['O'] < 0)
- $_GET['O'] = 0;
- }
- else {
+ $_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;
- }
- else {
+ $_GET["PP"] = bound(intval($_GET["PP"]), 50, 250);
+ } else {
$_GET["PP"] = 50;
}