aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2018-11-01 10:52:08 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2018-11-01 12:08:51 +0100
commita3b2cc69bc928e3748f6c3280079280e391ad7b0 (patch)
tree9c4d99811220d995c7f168cf26b00b80e993af87 /web
parent098888e2e9a6cca1a359242a6f9cf9f21f69286b (diff)
downloadbuildroot-test-a3b2cc69bc928e3748f6c3280079280e391ad7b0.tar.gz
buildroot-test-a3b2cc69bc928e3748f6c3280079280e391ad7b0.tar.bz2
web: propagate filters in the prev/next links
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'web')
-rw-r--r--web/index.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/web/index.php b/web/index.php
index 0612643..890de8a 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,6 +23,17 @@ function format_duration($seconds_count)
return "$hours$minutes$seconds";
}
+function format_url_args($args)
+{
+ return implode('&', array_map(
+ function ($v, $k) {
+ return sprintf("%s=%s", $k, $v);
+ },
+ $args,
+ array_keys($args)
+ ));
+}
+
$filters = array();
/* When no start is given, or start is a crazy value (not an integer),
@@ -147,13 +158,20 @@ echo "<p style=\"text-align: center;\">";
$total = bab_total_results_count();
+$prev_args = $filters;
+$next_args = $filters;
+$prev_args["step"] = $step;
+$next_args["step"] = $step;
+$prev_args["start"] = $start - $step;
+$next_args["start"] = $start + $step;
+
if ($start != 0)
- echo "<a href=\"?start=" . ($start - $step) . "\">Previous results</a>&nbsp;-&nbsp;";
+ echo "<a href=\"?" . format_url_args($prev_args) . "\">Previous results</a>&nbsp;-&nbsp;";
echo "(" . $start . " - " . ($start + $step) . " / " . $total . " results)&nbsp;-&nbsp;";
if (($start + $step) < $total)
- echo "<a href=\"?start=" . ($start + $step) . "\">Next results</a>";
+ echo "<a href=\"?" . format_url_args($next_args) . "\">Next results</a>";
echo "</p>";