Ibn Khaldun, the Philosopher of Ruins