The remembered sorting order should be recalled only when a default query is set (only when PMA_getDefaultSqlQueryForBrowse function called).  Otherwise table is sorted in latest remembered order even when a user executed his own query. Checking global default_query parameter prevents rendering a sorted table when user executes queries like "select from tableName where 1".