Fix for pagination not syncing correctly. Issue was due to using zero-based index numbers some places and non-zero-based index numbers in other places. Now both are tracked in the state object.