if (subElement instanceof DocPage) {
prepareTemplatePage((DocPage) subElement);
if (menu.showPager) {
// link to previous page
DocPage page = (DocPage) subElement;
DocElement prev = i == 0 ? null : menu.elements.get(i - 1);
if (prev != null && prev instanceof DocPage) {
page.prevPage = (DocPage) prev;
}