<% Site.listReferrers %>
renders a list of referrers, ie. a link to a url together with the read counter et al.

Sourcecode in Site/macros.js:
1:   function listReferrers_macro() {
2:      var c = getDBConnection("antville");
3:      var dbError = c.getLastError();
4:      if (dbError)
5:         return getMessage("error.database", dbError);
6:      // we're doing this with direct db access here
7:      // (there's no need to do it with prototypes):
8:      var d = new Date();
9:      d.setDate(d.getDate()-1); // 24 hours ago
10:     var query = "select ACCESSLOG_REFERRER, count(*) as \"COUNT\" from AV_ACCESSLOG " +
11:        "where ACCESSLOG_F_SITE = " + this._id + " and ACCESSLOG_DATE > {ts '" +
12:        d.format("yyyy-MM-dd HH:mm:ss") + "'} group by ACCESSLOG_REFERRER "+
13:        "order by \"COUNT\" desc, ACCESSLOG_REFERRER asc;";
14:     var rows = c.executeRetrieval(query);
15:     var dbError = c.getLastError();
16:     if (dbError)
17:        return getMessage("error.database", dbError);
18:     var skinParam = new Object();
19:     var referrer;
20:     while (rows.next()) {
21:        skinParam.count = rows.getColumnItem("COUNT");
22:        referrer = rows.getColumnItem("ACCESSLOG_REFERRER");
23:        skinParam.referrer = encode(referrer);
24:        skinParam.text = encode(referrer.length > 50 ? referrer.substring(0, 50) + "..." : referrer);
25:        this.renderSkin("referrerItem", skinParam);
26:     }
27:     rows.release();
28:     return;
29:  }