Check if offset and limit parameters are numbers

Previously, we were not converting the limit and offset
parameters to integer types, which meant that a) there
was no verification that they were valid numbers and b)
they were sent back as type string to the client, which
was wrong. This ensures that they are converted to valid
numbers.