I executing a function like this,
Apparently the currentPage parameter of getEntities() is an object, so adding 1 to it is not a sensible operation. Check with firebug what the type and contents of currentPage is.
currentPage
getEntities()