public Properties getProperties(TemplateResource templateResource) {
   Properties result = new Properties();
   if (this.isQueryForLogbookEntriesOfLogbook(templateResource.getRequest())) {
     String logbookKey = templateResource.getRequest().getParameter(QueryKeys.QUERY_KEY_LOGBOOK);
     result.put("entryView", true);
     result.put("logbookKey", logbookKey);
     result.put(
         "logbook_trhtml",
         new LogbookEntriesTrHtml(
             logbookKey,
             this.getShowFromEntry(templateResource.getRequest(), logbookKey),
             this.getShowToEntry(templateResource.getRequest(), logbookKey)));
     result.put("logbook_name", LogbookConfigDao.getInstance().getLabel(logbookKey));
     result.put("logbook_description", LogbookConfigDao.getInstance().getDescription(logbookKey));
     result.put(
         "logbook_pageshownfromtooptions",
         this.getPageFromToNavi(templateResource.getRequest(), logbookKey));
     result.put(
         "logbook_link2post", RedirectResolver.getLogbookMakePostURLWithQueryString(logbookKey));
     result.put(
         "logbook_postingsuccess", this.getShowSuccessfullPosting(templateResource.getRequest()));
   } else { // query for overview
     result.put("entryView", false);
     result.put("logbook_trhtml", LogbookOverviewTrHtml.getInstance());
   }
   return result;
 }
 private int getCountOfEntriesPerPage(HttpServletRequest rq, String logbookKey) {
   int result = RequestInterpreter.getCountOfEntriesPerPage(rq);
   if (result > LogbookConfigDao.getInstance().getEntryCount(logbookKey)) {
     result = LogbookConfigDao.getInstance().getEntryCount(logbookKey);
   }
   return result;
 }
 private int getTotalPageNumber(HttpServletRequest rq, String logbookKey) {
   int pagesize = this.getCountOfEntriesPerPage(rq, logbookKey);
   int allentriessize = LogbookConfigDao.getInstance().getEntryCount(logbookKey);
   int result = 1;
   if (pagesize > 0) {
     result = Math.round(allentriessize / pagesize);
     if (allentriessize % pagesize != 0) {
       result++;
     }
   }
   return result;
 }
  /**
   * returns the little page selection navigation. XXX not a controller element -> put in content /
   * view
   *
   * @param rq
   * @param logbookKey
   * @return
   */
  private String getPageFromToNavi(HttpServletRequest rq, String logbookKey) {
    int actpno = this.getCurrentPageNumber(rq, logbookKey);
    int totpno = this.getTotalPageNumber(rq, logbookKey);
    String result = "";
    if (LogbookConfigDao.getInstance().getEntryCount(logbookKey) > 0) {

      // create numbers to show as link
      ArrayList<Integer> showNumbersCandidates = new ArrayList<Integer>();
      showNumbersCandidates.add(1);
      showNumbersCandidates.add(2);
      showNumbersCandidates.add(actpno - 1);
      showNumbersCandidates.add(actpno);
      showNumbersCandidates.add(actpno + 1);
      showNumbersCandidates.add(totpno - 1);
      showNumbersCandidates.add(totpno);

      String tmp = "";
      // create previous page link
      String text = "previous"; // INTLANG
      if (actpno > 1) { // previous page exists
        tmp =
            this.getQueryString(logbookKey, (actpno - 1) + "", rq, logbookKey).getAsHtmlLinkHref();
        result += "<a href=\"" + tmp + "\">" + text + "</a>";
      } else {
        result += text;
      }
      result += "-";

      // create links
      ArrayList<Integer> setLinks = new ArrayList<Integer>();
      Integer before = null;
      for (Integer showNumbersCandidate : showNumbersCandidates) {
        if (setLinks.contains(showNumbersCandidate)
            || showNumbersCandidate <= 0
            || showNumbersCandidate > totpno) {
          continue;
        }
        if (before != null && before + 1 < showNumbersCandidate) {
          result += "...";
        }
        before = showNumbersCandidate;
        if (showNumbersCandidate == actpno) {
          result += "<strong>" + actpno + "</strong>";
        } else {
          tmp =
              this.getQueryString(logbookKey, showNumbersCandidate + "", rq, logbookKey)
                  .getAsHtmlLinkHref();
          result += "<a href=\"" + tmp + "\">" + showNumbersCandidate + "</a>";
        }
        setLinks.add(showNumbersCandidate);
        result += "-";
      }
      // create next page link
      text = "next"; // INTLANG
      if (actpno != totpno) { // next page exists
        tmp =
            this.getQueryString(logbookKey, (actpno + 1) + "", rq, logbookKey).getAsHtmlLinkHref();
        result += "<a href=\"" + tmp + "\">" + text + "</a>";
      } else {
        result += text;
      }
    }
    return result;
  }
 /**
  * return true, if it is not a query for the overview page.
  *
  * @param rq the request
  * @return true, if it is not a query for the overview page.
  */
 private boolean isQueryForLogbookEntriesOfLogbook(HttpServletRequest rq) {
   String logbookKey = rq.getParameter(QueryKeys.QUERY_KEY_LOGBOOK);
   return logbookKey != null && LogbookConfigDao.getInstance().keyExists(logbookKey);
 }