Fix sql errors for printer reports (page counter). closes #1985