1 <& elements/search.html,
2 'title' => 'Access Log',
5 'count_query' => $count_query,
11 'fields' => [ sub { shift->path },
12 sub { shift->num_entries },
13 sub { shift->avg_render_seconds },
15 'sort_fields' => [qw( path num_entries avg_render_seconds )],
21 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
26 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '_date');
27 push @extra_sql, "_date >= $beginning" if $beginning;
28 push @extra_sql, "_date <= $ending" if $ending;
30 $hashref{usernum} = $cgi->param('usernum') if $cgi->param('usernum') =~ /^\d+$/;
33 $extra_sql .= (keys(%hashref) ? ' AND ' : ' WHERE ' ). join(' AND ', @extra_sql)
35 $extra_sql .= ' GROUP BY path '
36 if $cgi->param('group_by') eq 'path';
40 'select' => join(' , ',
42 'COUNT(*) AS num_entries',
43 'ROUND(AVG(COALESCE(render_seconds,0)),1) '.
44 ' AS avg_render_seconds',
46 'table' => 'access_user_log',
47 'hashref' => \%hashref,
48 'extra_sql' => $extra_sql,
51 #uuh, no, need dates and usernum too, but whatever for now
52 my $count_query = 'SELECT COUNT(DISTINCT path) FROM access_user_log';