mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
require page number to be positive
This commit is contained in:
parent
ea0c9a8650
commit
c9331f61b4
1 changed files with 4 additions and 1 deletions
|
@ -23,7 +23,10 @@ defmodule PhilomenaWeb.PaginationPlug do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_page_number(%{"page" => page}) do
|
defp get_page_number(%{"page" => page}) do
|
||||||
to_integer(page) || 1
|
page
|
||||||
|
|> to_integer()
|
||||||
|
|> Kernel.||(1)
|
||||||
|
|> max(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_page_number(_params), do: 1
|
defp get_page_number(_params), do: 1
|
||||||
|
|
Loading…
Reference in a new issue