end while
variable next = yourVariable + stepLimit
variable previous = yourVariable - stepLimit
if previous less than 0 print some text
else print <a href="/yourFile.php?yourVariable=previous">previous</a>
if next less than numberOfRows print 
  <a href="/yourFile.php?yourVariable=next">next</a>
else print some text