code: protected void addSorting(CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) {
  
          boolean ascending = searchParams.isAscending();
          String ordering = getSortExpression(users, searchParams);
          if (ascending) {
              ordering += " ASC";
          } else {
              ordering += " DESC";
          }
  
          select.setOrdering(ordering);
      }
docs: Adds a sort order to an SQL query.<p>
  
  @param select the query
  @param users the user table alias
  @param searchParams the user search criteria