Here is the normal situation for reading a file in pages. Three pages of fives rows each:
SELECT FROM TABLE LIMIT 0,5
SELECT FROM TABLE LIMIT 5,5
SELECT FROM TABLE LIMIT 10,5
At the end of each page, add iPageSize (5) to iPageOffset.
Suppose your first page of processing is deletes a row.
If you now add 5 to iPageOffset, your next page will start at GGG instead of FFF.
So whenever you delete a row, add one less to iPageOffset.
stewjob handles this for you.
Whenever your job removes a row, increment $this→batch→$iInternalDeletedRowCounter;
An alternate way to bookmark your place in a table between pages is by using keys. Save the last key at end page and restart the file in startPage. So long as you declare your key in the data section of the job, it will be available for every run.