Added last parameter to get the last page