String sort = request.getParameter("sort");
if (sort == null || sort.trim().equals("")) {
sort = "rank";
}
if (sort.equals("name")) {
Collections.sort(requests, new CountedUrlByNameComparator());
} else {
Collections.sort(requests, new CountedUrlByCountComparator());
}
// now calculate the total number of requests, after filtering spam