summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weblog-adhocquery-html.lsp2
-rw-r--r--weblog-model.lua7
-rw-r--r--weblog-viewactivitylog-html.lsp9
-rw-r--r--weblog-viewusagestats-html.lsp7
4 files changed, 17 insertions, 8 deletions
diff --git a/weblog-adhocquery-html.lsp b/weblog-adhocquery-html.lsp
index c581fbe..b55fc4d 100644
--- a/weblog-adhocquery-html.lsp
+++ b/weblog-adhocquery-html.lsp
@@ -46,7 +46,7 @@ These tables contain the combined squid access log and dansguardian log for ever
This table contains the database history, including such information as which log files were loaded and how many entries they contained. The definition of the table is as follows:
<pre>
(
- logdatetime timestamp(0) without time zone NOT NULL,
+ logdatetime timestamp(3) without time zone NOT NULL,
msgtext text
)
</pre>
diff --git a/weblog-model.lua b/weblog-model.lua
index 14f394f..c4d5080 100644
--- a/weblog-model.lua
+++ b/weblog-model.lua
@@ -19,7 +19,7 @@ local configcontent = fs.read_file(configfile) or ""
local config = format.parse_ini_file(configcontent, "") or {}
local database_creation_script = {
- "CREATE TABLE dbhistlog (logdatetime timestamp(0) without time zone NOT NULL, msgtext text)",
+ "CREATE TABLE dbhistlog (logdatetime timestamp(3) without time zone NOT NULL, msgtext text)",
"CREATE TABLE pubblocklog(sourcename character varying(40), clientip inet NOT NULL, clientuserid character varying(64) NOT NULL, logdatetime timestamp(3) without time zone NOT NULL, uri text NOT NULL, bytes integer NOT NULL, reason text, score integer, shortreason text)",
"CREATE TABLE blocklog(sourcename character varying(40), clientip inet NOT NULL, clientuserid character varying(64) NOT NULL, logdatetime timestamp(0) without time zone NOT NULL, uri text NOT NULL, bytes integer NOT NULL, reason text, score integer, shortreason text)",
"CREATE TABLE pubweblog(sourcename character varying(40), clientip inet NOT NULL, clientuserid character varying(64) NOT NULL, logdatetime timestamp(3) without time zone NOT NULL, uri text NOT NULL, bytes integer NOT NULL, reason text, score integer, shortreason text)",
@@ -160,8 +160,7 @@ local databasedisconnect = function()
end
local logme = function(message)
- local sql = string.format("INSERT INTO dbhistlog VALUES ('%s', '%s')",
- os.date("%Y-%m-%d %H:%M:%S"), escape(message))
+ local sql = string.format("INSERT INTO dbhistlog VALUES ('now', '%s')", escape(message))
local res = assert (con:execute(sql))
end
@@ -479,7 +478,7 @@ local listusagestats = function()
local entries = {}
-- retrieve a cursor
local sql = "SELECT sourcename, date, sum(numrequest) AS numrequest, sum(numblock) AS numblock " ..
- "FROM usagestat GROUP BY sourcename, date ORDER BY sourcename, date"
+ "FROM usagestat GROUP BY sourcename, date ORDER BY date, sourcename"
cur = assert (con:execute(sql))
row = cur:fetch ({}, "a")
while row do
diff --git a/weblog-viewactivitylog-html.lsp b/weblog-viewactivitylog-html.lsp
index 9aa681e..516b79e 100644
--- a/weblog-viewactivitylog-html.lsp
+++ b/weblog-viewactivitylog-html.lsp
@@ -1,14 +1,19 @@
<% local data, viewlibrary, page_info, session = ... %>
+<% require("viewfunctions") %>
+
+<% local subdata, pagedata = paginate(data.value, page_info.clientdata, 100) %>
+
<H1><%= html.html_escape(data.label) %></H1>
+<% displaypagination(pagedata, page_info) %>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;" class="header">Date</TD>
<TD style="white-space:nowrap;" WIDTH="90%" class="header">Message</TD>
</TR>
-<% for i,log in ipairs(data.value) do %>
+<% for i,log in ipairs(subdata) do %>
<TR>
- <TD><%= html.html_escape(log.logdatetime) %></TD>
+ <TD><%= html.html_escape(string.gsub(log.logdatetime, "%..*", "")) %></TD>
<TD><%= html.html_escape(log.msgtext) %></TD>
</TR>
<% end %>
diff --git a/weblog-viewusagestats-html.lsp b/weblog-viewusagestats-html.lsp
index 706b86c..708b374 100644
--- a/weblog-viewusagestats-html.lsp
+++ b/weblog-viewusagestats-html.lsp
@@ -1,5 +1,10 @@
<% local data, viewlibrary, page_info, session = ... %>
+<% require("viewfunctions") %>
+
+<% local subdata, pagedata = paginate(data.value, page_info.clientdata, 100) %>
+
<H1><%= html.html_escape(data.label) %></H1>
+<% displaypagination(pagedata, page_info) %>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;" class="header">Date</TD>
@@ -8,7 +13,7 @@
<TD style="white-space:nowrap;" WIDTH="90%" class="header">Blocks</TD>
</TR>
-<% for i,stat in ipairs(data.value) do %>
+<% for i,stat in ipairs(subdata) do %>
<TR>
<TD><%= html.html_escape(stat.date) %></TD>
<TD><%= html.html_escape(stat.sourcename) %></TD>