Mishkat al-Masabih 1337
وَعَنِ ابْنِ عَبَّاسٍ قَالَ: سَافَرَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ سَفَرًا فَأَقَامَ تِسْعَةَ عَشَرَ يَوْمًا يُصَلِّي رَكْعَتَيْنِ رَكْعَتَيْنِ قَالَ ابْنُ عَبَّاسٍ: فَنَحْنُ نُصَلِّي فِيمَا بَيْنَنَا وَبَيْنَ مَكَّةَ تِسْعَةَ عَشَرَ رَكْعَتَيْنِ رَكْعَتَيْنِ فَإِذَا أَقَمْنَا أَكْثَرَ مِنْ ذَلِك صلينَا أَرْبعا. رَوَاهُ البُخَارِيّ
From Ibn ʿAbbas, who said: The Prophet ﷺ went on a journey and stayed nineteen days, praying two rakʿahs, two rakʿahs. Ibn ʿAbbas said: "So we pray two rakʿahs, two rakʿahs, for nineteen [days] between us and Makkah, and if we stay longer than that, we pray four." Reported by al-Bukhari.