Phase structure of string theory and the Random Energy Model