<%int maxLinks = slideLinksCount;  // Max number of links to display at the same time
  if(maxLinks > 25 || maxLinks <= 0) maxLinks = 20;
  int i, start = (imageNum / maxLinks) * maxLinks - 1;
  if(start < 0) { start = 0; maxLinks--; out.print("$text.image "); }
  else
  { Map vars = (Map)fileVariables.get(files[start-1]);
    out.print("<a href=\"" + firstPage + "\" title=\"$text.firstPage\">&laquo; </a>|<a href=\"" + vars.get("currentPage") + "\" title=\"$text.previousPage\"> &lt; </a>");
  }
  out.print("|");
  for(i=start; i<files.length && i<(start+maxLinks); i++) {
    Map vars = (Map)fileVariables.get(files[i]);
    if(i+1 != imageNum) out.print("<a href=\"" + vars.get("currentPage") + "\"> ");
    else out.print("<span class=\"current\"> ");
    out.print((i+1));
    if(i+1 != imageNum) out.print(" </a>");
    else out.print(" </span>");
    out.print("|");
  }  
  if(files.length > (start+maxLinks))
  { Map vars = (Map)fileVariables.get(files[start+maxLinks]);
    out.print("<a href=\"" + vars.get("currentPage") + "\" title=\"$text.nextPage\"> &gt; </a>|<a href=\"" + lastPage + "\" title=\"$text.lastPage\"> &raquo;</a>"); }
%>