mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
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.
This commit is contained in:
@@ -285,7 +285,8 @@ END
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'log'});
|
||||
print "<p><b>$Lang::tr{'firewall hits'} $date: $lines</b></p>";
|
||||
|
||||
$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 "<td align='center' width='50%'>";
|
||||
if ($prev != -1) {
|
||||
print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?0,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>First</a> ";
|
||||
print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$prev,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'older'}</a>"; }
|
||||
else {
|
||||
print "$Lang::tr{'older'}"; }
|
||||
print "First $Lang::tr{'older'}"; }
|
||||
print "</td>\n";
|
||||
|
||||
print "<td align='center' width='50%'>";
|
||||
if ($next >= 0) {
|
||||
print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'newer'}</a>"; }
|
||||
print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'newer'}</a> ";
|
||||
print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$lastPageIndex,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>Last</a>"; }
|
||||
else {
|
||||
print "$Lang::tr{'newer'}"; }
|
||||
print "$Lang::tr{'newer'} Last"; }
|
||||
print "</td>\n";
|
||||
|
||||
print <<END
|
||||
|
||||
Reference in New Issue
Block a user