private void addLastLink(Page<T> page, String pageParam, String sizeParam) {
   if (page.isLast()) {
     Link link =
         buildPageLink(pageParam, page.getTotalPages(), sizeParam, page.getSize(), Link.REL_LAST);
     add(link);
   }
 }
  /**
   * Gets the link node of the last page.
   *
   * @param page the pagination object
   * @param contextPath current context path of servlet
   * @return the node
   */
  private Element getLastElement(final Page<?> page, final String contextPath) {
    final Element result = new Element("li");

    final Element a = new Element("a");
    a.setAttribute("href", getPagedParams(contextPath, page.getTotalPages() - 1, page.getSize()));
    result.addChild(a);

    final Element icon = new Element("i");
    icon.setAttribute("class", "glyphicon glyphicon-step-forward");

    a.addChild(icon);

    if (page.isLast()) {
      result.setAttribute("class", "disabled");
    }

    return result;
  }
  public PageResource(Page<T> page, String pageParam, String sizeParam) {
    super();
    number = page.getNumber();
    size = page.getSize();
    numberOfElements = page.getNumberOfElements();
    content = page.getContent();
    sort = page.getSort();
    firstPage = page.isFirst();
    lastPage = page.isLast();
    totalPages = page.getTotalPages();
    totalElements = page.getTotalElements();

    addPreviousLink(page, pageParam, sizeParam);
    addNextLink(page, pageParam, sizeParam);
    addFirstLink(page, pageParam, sizeParam);
    addLastLink(page, pageParam, sizeParam);
    addSelfLink(page, pageParam, sizeParam);
  }