!752
static S webLogProgramID = "#1002576";
static S webLog = "webLog";
static S html(S subUri, Map params) {
if (!master()) ret "Sorry, not authorized.";
L keepFields = litlist("full", "n");
boolean full = webTrue(params.get("full"));
L data; // contains maps or structure()-d maps
if (full)
data = scanLog(getProgramFile(webLogProgramID, webLog));
else
data = (L) call(getMainBot(), "getRecentWebLog");
new StringBuffer buf;
pcall {
int x = 0;
int n;
if (!empty(params.get("n")))
n = parseInt(params.get("n"));
else
n = max(0, l(data)-1)/100*100;
for (int i = min(n+100, l(data))-1; i >= n; i--) {
S entry = structureOrText(data.get(i));
buf.append("Entry " + (i+1) + ": " + entry + "\n");
}
}
ret p(href(selfLink(params, keepFields, "full", "0"), "Recent Log")
+ " | "
+ href(selfLink(params, keepFields, "full", "1"), "Full Log"))
+ p("n=" + l(data))
+ pageNav(params, keepFields, l(data), "n") // has its own
+ sourceCodeToHTML(buf); }