Added lim variable to pagination.