One way to view Jesus' trials before Pilate is Pilate's sense that Jesus is completely innocent and actually tries about six times to release Jesus. However, being a weak and vacillating governor, he must do this by placating the crowd and his boss, Caesar. Note the list below of Pilates attempts to convince the crown and release Jesus:
Attempt #1
John 18:38, 39 - Pilate tries to use the annual release of prisoner to have Jesus release but the crowd shouts that they want Barabbas.
Attempt #2
John 19:1-5 - public executions performed two functions in the ancient Roman empire - a warning to insurrectionists, AND, ghoulish entertainment for the masses. It was an attempt to satisfy the latter that Pilate had Jesus flogged and scourged to ameliorate their blood lust. It did not work.
Attempt #3
John 19:6 - Pilate again declares that he find no basis for a charge against Jesus. Actually the Jews had brought no charges under Roman law, so Pilates response was legally correct.
Attempt #4
John 19:8 - Pilate become very afraid and tries even harder to release Jesus
Attempt #5
John 19:12 - Pilate is becoming desperate and tries even harder to release Jesus and bring out the judgement seat.
Attempt #6
John 19:13 - While sitting on the judgement seat, Matthew adds another detail about Pilate's wife receiving a dream about "this innocent man". Matthew also adds that Pilate AGAIN asks what the charges were for the death sentence but receives no sensible reply.
In view of the above clear pattern, it appears that, among other things, Pilate scourged Jesus, without any legal reason (by his own admission) in a futile attempt to placate the crowd to release Jesus.