Title: Ibn Khaldun in Egypt : His Public Functions and His Historical Research