diff --git a/lib/philomena_web/plugs/pagination_plug.ex b/lib/philomena_web/plugs/pagination_plug.ex index f1706952..0dc8da91 100644 --- a/lib/philomena_web/plugs/pagination_plug.ex +++ b/lib/philomena_web/plugs/pagination_plug.ex @@ -23,7 +23,10 @@ defmodule PhilomenaWeb.PaginationPlug do end defp get_page_number(%{"page" => page}) do - to_integer(page) || 1 + page + |> to_integer() + |> Kernel.||(1) + |> max(1) end defp get_page_number(_params), do: 1