For the ninth straight year, the Phillies will not finish with a winning record. A team with a franchise-record payroll will need to win their final two games to avoid a losing season.

But they can still reach the playoffs. They just need everything to go their way over the next two days.

Their postseason hopes were given some life late on Friday night when Gabe Kapler’s Giants lost on a walk-off homer. The Phillies can be eliminated as early as Saturday but can clinch on Sunday even if they lose one of their final two games.

The Dodgers, Braves, Cubs, Padres, Reds and Marlins have clinched playoff spots.

The Phillies can finish no better than eighth place, which means they’ll head to Dodger Stadium if they manage to make the playoffs. But first, they have to chase some teams down. The Phillies, according to FanGraphs, had an 87% chance to reach the playoffs on September 19. Those odds dropped to 29% after Friday night. So you’re saying there’s a chance?

If the Phillies go 0-2 (28-32 overall)

They’re done. If the Phillies lose both Zack Wheeler’s start on Saturday night and Aaron Nola’s start on Sunday, they’ll be counting down to spring training. But first, there will likely be some serious conversations about the future of the franchise.

If the Phillies go 1-1 (29-31 overall)

They’ll need the Giants to lose both games to San Diego and the Brewers to win no more than one of their final two games against St. Louis. All three teams would finish with the same record and the Phillies would win the tiebreaker based on having a better divisional record than the Brewers and Giants.

If the Phillies go 2-0 (30-30 overall)

They’re a playoff team if the Giants lose at least one of their next two games. It won’t matter what the Brewers do.

This is when it could get complicated. By the end of the weekend, the Cardinals will have played just 58 games. If they lose Saturday and Sunday to the Brewers, they’ll be 29-29 for a .500 record. If the Phillies finish 30-30, but trail the Giants and are tied with the Cardinals on winning percentage, St. Louis may be required to play a doubleheader Monday in Detroit. If they play the doubleheader and lose their final four games, the Phillies would pass them. If they play the doubleheader and win one of the games, they’ll stay ahead of the Phillies on a tiebreaker.

*Correction: This article was corrected from saying the Phillies can clinch a playoff berth on Sunday even if they lose both of their final two games, to they can clinch a playoff berth on Sunday even if they lose one of their final two games.