Shouldn't this be in if (isset($sql_data[POST_REVISIONS_TABLE]['sql']))? Otherwise it might not be the actual count.