diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js
index 270f387f8..0e71bacf3 100644
--- a/htroot/js/yacysearch.js
+++ b/htroot/js/yacysearch.js
@@ -80,46 +80,45 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localResourceS
document.getElementById("remoteResourceSize").firstChild.nodeValue = remoteResourceSize;
document.getElementById("remoteIndexCount").firstChild.nodeValue = remoteIndexCount;
document.getElementById("remotePeerCount").firstChild.nodeValue = remotePeerCount;
-
- var resNav = document.getElementById("resNav");
- resNav.firstChild.nodeValue = "X";
+ document.getElementById("resNav").firstChild.nodeValue = "X";
// compose page navigation
resnav = "";
- thispage = offset / itemsperpage;
- if (thispage == 0) {
- resnav += (" ");
- } else {
- resnav += (" ");
- }
- numberofpages = Math.min(10, 1 + (((localResourceSize + remoteResourceSize) - 1) / itemsperpage));
-
- for (i = 0; i < numberofpages; i++) {
- if (i == thispage) {
- resnav += " ");
- } else {
- resnav += (" ");
- }
- }
- if (thispage >= numberofpages) {
- resnav += ("");
- } else {
- resnav += ("");
- }
+ thispage = Math.floor(offset / itemsperpage);
+ if (thispage == 0) {
+ resnav += (" ");
+ } else {
+ resnav += (" ");
+ }
- //document.getElementById("resNav").firstChild.nodeValue = resnav;
+ numberofpages = Math.min(10, 1 + ((totalcount - 1) / itemsperpage));
+ if (!numberofpages) numberofpages = 10;
+ for (i = 0; i < numberofpages; i++) {
+ if (i == thispage) {
+ resnav += " ");
+ } else {
+ resnav += (" ");
+ }
+ }
+ if (thispage >= numberofpages) {
+ resnav += ("");
+ } else {
+ resnav += ("");
+ }
+
+ document.getElementById("resNav").innerHTML = resnav;
}
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 308a39d20..3a76dcbb0 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -234,7 +234,7 @@ function latestinfo() {
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
var rsp = eval("(" + self.xmlHttpReq.responseText + ")");
- statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount);
+ statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount, rsp.navurlBase);
}
}
self.xmlHttpReq.send(null);
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index f6a5b82d2..d5a78374c 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -740,8 +740,8 @@ public class yacysearch {
}
final int indexcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();
- prop.put("num-results_offset", offset);
- prop.put("num-results_itemscount", Formatter.number(0, true));
+ prop.put("num-results_offset", offset + 1);
+ prop.put("num-results_itemscount", Formatter.number(offset + theSearch.getQuery().itemsPerPage > indexcount ? offset + indexcount % theSearch.getQuery().itemsPerPage : offset + theSearch.getQuery().itemsPerPage, true));
prop.put("num-results_itemsPerPage", itemsPerPage);
prop.put("num-results_totalcount", Formatter.number(indexcount, true));
prop.put("num-results_globalresults", global && (indexReceiveGranted || clustersearch) ? "1" : "0");
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index 87ed0b642..0b2ae0783 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -56,7 +56,7 @@
#(/content)#
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index c0608772f..dde0c94c5 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -101,6 +101,7 @@ public class yacysearchitem {
prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
+ prop.put("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString());
final String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self");
if (theQuery.contentdom == ContentDomain.TEXT) {
diff --git a/htroot/yacysearchlatestinfo.java b/htroot/yacysearchlatestinfo.java
index f4e818516..031f91892 100644
--- a/htroot/yacysearchlatestinfo.java
+++ b/htroot/yacysearchlatestinfo.java
@@ -20,7 +20,7 @@ public class yacysearchlatestinfo {
// the event does not exist.
// to avoid missing patterns, we return dummy values
prop.put("offset", 0);
- prop.put("itemscount", -1);
+ prop.put("itemscount", 0);
prop.put("itemsperpage", 10);
prop.put("totalcount", 0);
prop.put("localResourceSize", 0);
@@ -36,7 +36,7 @@ public class yacysearchlatestinfo {
final int totalcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();
final int offset = theQuery.neededResults() - theQuery.displayResults() + 1;
prop.put("offset", offset);
- prop.put("itemscount", -1);
+ prop.put("itemscount",Formatter.number(offset + theSearch.getQuery().itemsPerPage >= totalcount ? offset + totalcount % theSearch.getQuery().itemsPerPage - 1 : offset + theSearch.getQuery().itemsPerPage - 1));
prop.put("itemsperpage", theSearch.getQuery().itemsPerPage);
prop.put("totalcount", Formatter.number(totalcount, true));
prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
@@ -44,6 +44,7 @@ public class yacysearchlatestinfo {
prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
+ prop.putJSON("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString());
return prop;
}
diff --git a/htroot/yacysearchlatestinfo.json b/htroot/yacysearchlatestinfo.json
index b58401deb..6e00012ee 100644
--- a/htroot/yacysearchlatestinfo.json
+++ b/htroot/yacysearchlatestinfo.json
@@ -1,4 +1,5 @@
{
+"offset": "#[offset]#",
"itemscount": "#[itemscount]#",
"itemsperpage": "#[itemsperpage]#",
"totalcount": "#[totalcount]#",
@@ -6,5 +7,6 @@
"localMissCount": "#[localMissCount]#",
"remoteResourceSize": "#[remoteResourceSize]#",
"remoteIndexCount": "#[remoteIndexCount]#",
-"remotePeerCount": "#[remotePeerCount]#"
+"remotePeerCount": "#[remotePeerCount]#",
+"navurlBase": "#[navurlBase]#"
}