When organization grouping is enabled, modifies sort order to group by group_header first before applying user-selected ordering. This prevents organizations in the same group from being split across pagination boundaries. Adds CASE expression to sort ungrouped orgs (null/empty group_header) last, then groups alphabetically, then applies the requested orderBy within each group.