Mishkat al-Masabih
Ibn ‘Abbas said the Prophet (ﷺ) made a journey during which he had a stop of nineteen days, and he prayed two rak'as at each time of prayer. Ibn ‘Abbas said, “So when we are stopping nineteen days between here and Mecca we pray two rak'as each time, but when we stop more than that we pray four.” Bukhari transmitted it.
وَعَنِ ابْنِ عَبَّاسٍ قَالَ: سَافَرَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ سَفَرًا فَأَقَامَ تِسْعَةَ عَشَرَ يَوْمًا يُصَلِّي رَكْعَتَيْنِ رَكْعَتَيْنِ قَالَ ابْنُ عَبَّاسٍ: فَنَحْنُ نُصَلِّي فِيمَا بَيْنَنَا وَبَيْنَ مَكَّةَ تِسْعَةَ عَشَرَ رَكْعَتَيْنِ رَكْعَتَيْنِ فَإِذَا أَقَمْنَا أَكْثَرَ مِنْ ذَلِك صلينَا أَرْبعا. رَوَاهُ البُخَارِيّ
Reference