Apply limit, offset for get activities query with mysql