       </tbody>
     </table>
 
-    <Pagination nr_of_pages={Integer.floor_div(@nr_of_filtered, @per_page)}
+    <Pagination nr_of_pages={Float.ceil(@nr_of_filtered / @per_page) |> round}
                 {=@nr_of_unfiltered} {=@nr_of_filtered} {=@page} {=@per_page}
                 click="paginate" class="mb-4 max-w-3xl" />
 

  import PanWeb.Router.Helpers

  def mount(_params, _session, socket) do
    socket = assign(socket, sort_by: :inserted_at, sort_order: :desc, page: 1, per_page: 10)

    {:ok, socket |> fetch() |> paginate()}
  end

    assign(socket, opmls: sorted_opmls)
  end

  defp filter(%{assigns: %{filter_by: filter_by, opmls: opmls}} = socket) do
    filtered_opmls = Enum.filter(opmls, &opml_contains?(&1, filter_by))
    assign(socket, opmls: filtered_opmls, nr_of_filtered: Enum.count(filtered_opmls))
  end

  defp opml_contains?(opml, value) do
    Enum.any?(Map.values(opml), &String.contains?(&1 |> inspect(), value))
  end

  def handle_event("paginate", %{"page" => page}, socket) do
    {:noreply, assign(socket, page: String.to_integer(page)) |> paginate()}
  end
