import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.util.collection.Pagination;
+import net.pterodactylus.util.number.Numbers;
import net.pterodactylus.util.template.DataProvider;
import net.pterodactylus.util.template.Template;
}
}
Collections.sort(allPosts, Post.TIME_COMPARATOR);
- dataProvider.set("posts", allPosts);
+ Pagination<Post> pagination = new Pagination<Post>(allPosts, 25).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0));
+ dataProvider.set("pagination", pagination);
+ dataProvider.set("posts", pagination.getItems());
}
/**
<h1><%= Page.Index.PostList.Title|l10n|html></h1>
<div id="posts">
- <%getpage>
- <%paginate list=posts pagesize=25>
<%= page|store key=pageParameter>
<%include include/pagination.html>
<%foreach pagination.items post>