From: Alf Høgemark Date: Sat, 8 Feb 2014 07:12:53 +0000 (+0100) Subject: firewalllog.dat: Add First and Last links, for fast navigation in log lines X-Git-Tag: v2.15-rc1~126^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f69446d2fa5fc519c223faeb9506842e191e46ca;p=ipfire-2.x.git firewalllog.dat: Add First and Last links, for fast navigation in log lines Add two links for navigating in log pages, one for going to the first page and one for goint to the last page. Introduce variable which points to the first log line to display on the last possible page. The commit contains hardcoded text for Last and First, and I am also uncertain how spaces between links should be handled. So this should be improved based on feedback. --- diff --git a/html/cgi-bin/logs.cgi/firewalllog.dat b/html/cgi-bin/logs.cgi/firewalllog.dat index 73e62eab07..2711eba3b3 100644 --- a/html/cgi-bin/logs.cgi/firewalllog.dat +++ b/html/cgi-bin/logs.cgi/firewalllog.dat @@ -285,7 +285,8 @@ END &Header::openbox('100%', 'left', $Lang::tr{'log'}); print "

$Lang::tr{'firewall hits'} $date: $lines

"; -$start = $lines - ${Header::viewsize} if ($start >= $lines - ${Header::viewsize}); +my $lastPageIndex = $lines - ${Header::viewsize}; +$start = $lastPageIndex if ($start >= $lastPageIndex); $start = 0 if ($start < 0); my $prev; @@ -297,7 +298,7 @@ my $prev; } my $next; - if ($start == $lines - ${Header::viewsize}) { + if ($start == $lastPageIndex) { $next = -1; } else { $next = $start + ${Header::viewsize}; @@ -402,16 +403,18 @@ END print ""; if ($prev != -1) { + print "First "; print "$Lang::tr{'older'}"; } else { - print "$Lang::tr{'older'}"; } + print "First $Lang::tr{'older'}"; } print "\n"; print ""; if ($next >= 0) { - print "$Lang::tr{'newer'}"; } + print "$Lang::tr{'newer'} "; + print "Last"; } else { - print "$Lang::tr{'newer'}"; } + print "$Lang::tr{'newer'} Last"; } print "\n"; print <