Commit 0aa236a5 authored by deuce's avatar deuce
Browse files

Add a counter to the while() loops in case of infinite...

parent 34206c16
......@@ -23,19 +23,27 @@ if(lastpage>total_pages)
lastpage=total_pages;
/* Ensure currpage is inside first/last */
var lcount=0;
while(currpage>lastpage) {
lcount++;
firstpage++;
lastpage=firstpage+max_pages-1;
if(lastpage>total_pages)
lastpage=total_pages;
if(lcount>5000)
currpage=lastpage;
}
/* Try adjust so currpage is in the middle of firstpage and lastpage */
lcount=0;
while(currpage>firstpage+(max_pages/2) && lastpage<total_pages) {
lcount++;
firstpage++;
lastpage=firstpage+max_pages-1;
if(lastpage>total_pages)
lastpage=total_pages;
if(lcount>5000)
break;
}
/* Build the links now */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment