Added variable counterEnd for the last result on a page