ap/collection: don't advertise next page if no more entries

And off-by-one error caused the last page
to always advertise one more page eventhough
the absence of further items is known
This commit is contained in:
Oneric 2025-04-20 00:21:34 +02:00
parent 5987dd43d4
commit 89678f92d9

View file

@ -290,7 +290,7 @@ def collection(collection, iri, page, show_items \\ true, total \\ nil) do
"orderedItems" => if(show_items, do: items, else: [])
}
if offset < total do
if offset + 10 < total do
Map.put(map, "next", "#{iri}?page=#{page + 1}")
else
map