Added total and fixed pagination issue.