--- dspam.cgi 2005-07-14 15:29:33.000000000 +0200 +++ dspam-patched.cgi 2005-08-25 08:20:37.000000000 +0200 @@ -160,6 +160,11 @@ # sub DisplayHistory { + my($history_per_site) = $CONFIG{'HISTORY_PER_SITE'}; + my($history_site) = $FORM{'history_site'}; + my($begin) = 1; + my($all_lines , $end, $history_pages); + my(@buffer, @history, $line, %rec); my($rowclass) = "rowEven"; @@ -177,12 +182,34 @@ &error("No historical data is available"); } - open(LOG, "tail -$CONFIG{'HISTORY_SIZE'} $LOG|"); + if ($CONFIG{'HISTORY_PER_SITE'} > 0) { + $history_site = 1 if $history_site eq ""; + $end = $history_site * $CONFIG{'HISTORY_PER_SITE'}; + $all_lines = $CONFIG{'HISTORY_SIZE'}; + + $end = $CONFIG{'HISTORY_SIZE'} if $end > $CONFIG{'HISTORY_SIZE'}; + $begin = $end - $CONFIG{'HISTORY_PER_SITE'} + 1; + + open(LINES,"wc -l $LOG|"); + while (){ + chomp; + $all_lines = $1 if /([0-9]*) /; + } + close (LINES); + + $history_pages = $all_lines / $CONFIG{'HISTORY_PER_SITE'}; + + open(LOG, "sed -n \'$begin,$end\p\' $LOG|"); + } else { + open(LOG, "sed -n \'1,$CONFIG{'HISTORY_SIZE'}\p\' $LOG|"); + } + while() { push(@buffer, $_); } close(LOG); + # Preseed retraining information and delivery errors foreach $line (@buffer) { @@ -298,7 +325,19 @@ } while($line = pop(@history)) { $DATA{'HISTORY'} .= $line; } + + if ($CONFIG{'HISTORY_PER_SITE'} > 0) { + $DATA{'HISTORY'} .= "
Page:
<"; + for(my $i = 1; $i < $history_pages + 1; $i++) { + if ($i == $history_site) { + $DATA{'HISTORY'} .= " $i "; + } else { + $DATA{'HISTORY'} .= " $i "; + } + } + $DATA{'HISTORY'} .= ">"; + } &output(%DATA); } --- configure.pl.in 2005-07-14 15:29:33.000000000 +0200 +++ configure-patched.pl.in 2005-08-25 08:21:44.000000000 +0200 @@ -37,6 +37,7 @@ # Default DSPAM display $CONFIG{'HISTORY_SIZE'} = 200; # Number of items in history +$CONFIG{'HISTORY_PER_SITE'} = 20; # Number of items displayed per site in history. Set to 0 for display all on one page. $CONFIG{'MAX_COL_LEN'} = 50; # Max chars in list columns $CONFIG{'SORT_DEFAULT'} = "Date"; # Show quarantine by "Date" or "Rating" $CONFIG{'3D_GRAPHS'} = 1;