Use range() instead of loop up or down

The function range() handles the case when end value is less than start value. This is used together with array_merge() to append pages independent of the range is increasing or decreasing.
Merge pull request #3 from md2perpe/patch-1

Use range() instead of loop up or down