Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Fixed labelmaker pagination on PostgreSQL (#779)

LunarEclipse36304df4d8a0826
diff --git a/backend/internal/data/repo/pagination.go b/backend/internal/data/repo/pagination.go
index d8878d02..2a357331 100644
--- a/backend/internal/data/repo/pagination.go
+++ b/backend/internal/data/repo/pagination.go
@@ -8,5 +8,10 @@ type PaginationResult[T any] struct {
}
func calculateOffset(page, pageSize int) int {
- return (page - 1) * pageSize
+ offset := (page - 1) * pageSize
+ if offset < 0 {
+ return 0
+ } else {
+ return offset
+ }
}