X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FNewPage.java;h=175795262fee1ef5cc8221cdb0e96f153b36bdee;hp=71200d85ab68c44ef0a8bb22386c6b0faf5fa6d0;hb=419098bcd6215125408b29e60bd888e60979d37b;hpb=8f02544d31f323ae9053dd9a11a99eacd8cf5bcd diff --git a/src/main/java/net/pterodactylus/sone/web/NewPage.java b/src/main/java/net/pterodactylus/sone/web/NewPage.java index 71200d8..1757952 100644 --- a/src/main/java/net/pterodactylus/sone/web/NewPage.java +++ b/src/main/java/net/pterodactylus/sone/web/NewPage.java @@ -1,5 +1,5 @@ /* - * Sone - NewPage.java - Copyright © 2013 David Roden + * Sone - NewPage.java - Copyright © 2013–2015 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +17,8 @@ package net.pterodactylus.sone.web; +import static net.pterodactylus.sone.utils.NumberParsers.parseInt; + import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -30,7 +32,6 @@ import net.pterodactylus.sone.data.PostReply; import net.pterodactylus.sone.notify.ListNotificationFilters; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.collection.Pagination; -import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -77,7 +78,7 @@ public class NewPage extends SoneTemplatePage { Collections.sort(sortedPosts, Post.TIME_COMPARATOR); /* paginate them. */ - Pagination pagination = new Pagination(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); + Pagination pagination = new Pagination(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("page"), 0)); templateContext.set("pagination", pagination); templateContext.set("posts", pagination.getItems()); }