this seems like very simple maths but somehow, my brain cant think ...
i am trying to implement pagination and will need to calculate the item offset to use in limi
Honestly depends. I'm no PHP person, but I'll put both out there. If you are pulling your records in to some form of collection (list, array, etc.) then your formula should be:
offset = (page - 1) * itemsPerPage
This is because most (again, I'm not a PHP person) arrays and lists use 0 for their first element. If they do not use 0 for their first element and/or you're pulling from a table or something else where the IDs start at 1, then it should be:
offset = (page - 1) * itemsPerPage + 1
I hope that's clear and helps.