Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#854 add summary average on filtered page lists

open
nobody
5
2014-08-16
2011-02-02
Anonymous
No

In awstats.pl 6.95, add the following code inside the block:

            if (   $HTMLOutput{'urldetail'}
                    || $HTMLOutput{'urlentry'}
                    || $HTMLOutput{'urlexit'} )
            {

below the section of code that shows:

                    if ($Debug) {
                            debug(

"Total real / shown : $TotalPages / $total_p - $TotalEntries / $total_e - $TotalExits / $total_x - $TotalBytesPages / $total_k",
2
);
}

=======================
if ( $FilterIn{'url'} || $FilterEx{'url'} ) {
my $avg_p = sprintf("%.1f", ($total_p / ($count || 1)));
my $avg_e = sprintf("%.1f", ($total_e / ($count || 1)));
my $avg_x = sprintf("%.1f", ($total_x / ($count || 1)));
my $avg_k = Format_Bytes($total_k / ($total_p || 1));
print "Avg. for filter inclusion/exclusion" . ($FilterIn{'url'} ? "
  Include: $FilterIn{'url'}" : '') . ($FilterEx{'url'} ? "
  Exclude: $FilterEx{'url'}" : '') . "$avg_p ($total_p)$avg_k (" . Format_Bytes($total_k) . ")$avg_e
($total_e)$avg_x
($total_x)\n";
}
=======================

This code will output the average (and totals) for the filtered (both included and excluded) page details. This provides a nice visibility into how much data is associated with a specific search.

I'm not sure what the change is in awstats 7.0 since the code has changed so much.

Discussion