Don't attempt array sort when no sort fields present.
Removed references to old "direction" option.
Added test for "sort_empty" option.