5 * Analyze our ACCESS_LOG
9 include_once("lib/PageList.php");
11 class WikiPlugin_RecentReferrers extends WikiPlugin
14 return _("RecentReferrers");
17 function getDescription () {
18 return _("Analyse access log.");
21 function getVersion() {
22 return preg_replace("/[Revision: $]/", '',
26 function getDefaultArguments() {
29 PageList::supportedArgs(),
37 function run($dbi, $argstr, &$request, $basepage) {
39 return HTML::div(array('class' => "error"), "Error: no ACCESS_LOG");
41 $args = $this->getArgs($argstr, $request);
42 $table = HTML::table(array('cellpadding' => 1,
45 'class' => 'pagelist'));
46 if (!$args['noheader'] and !empty($args['caption']))
47 $table->pushContent(HTML::caption(array('align'=>'top'), $args['caption']));
49 $limit = $args['limit'];
50 $accesslog =& $request->_accesslog;
51 if ($logiter = $accesslog->get_referer($limit, "external_only")
52 and $logiter->count()) {
53 $table->pushContent(HTML::tr(HTML::th("Target"),HTML::th("Referrer"),
54 HTML::th("Host"),HTML::th("Date")));
55 while($logentry = $logiter->next()) {
56 $table->pushContent(HTML::tr(HTML::td($logentry['request']),
57 HTML::td($logentry['referer']),
58 HTML::td($logentry['host']),
59 HTML::td($logentry['time'])
67 // (c-file-style: "gnu")
72 // c-hanging-comment-ender-p: nil
73 // indent-tabs-mode: nil