should a Buddhist defend truth or is it preferred to remain uninvolved
Maybe it depends, on the topic perhaps?
When the topic is Dhamma there is for example MN 22:
Then those monks, desiring to pry the monk Arittha Formerly-of-the-Vulture-Killers away from that pernicious viewpoint, quizzed him back and forth and rebuked him ...
So when the monks were unable to pry the monk Arittha Formerly-of-the-Vulture-Killers away from that pernicious viewpoint, they went to the Blessed One ...
I'm not certain they did right; but then the Blessed One himself called, and rebuked, and corrected him.
Although, that's within the context of a pre-existing relationship: i.e. where the Buddha is formally the monk's teacher.
Outside of that relationship maybe what you do is "offer" the truth (especially but perhaps not only when asked), rather than being bossy about it. The Buddha himself started his mission only for "those with ears" in MN 26:
Then, having understood Brahma's invitation, out of compassion for beings, I surveyed the world with the eye of an Awakened One. As I did so, I saw beings with little dust in their eyes and those with much, [...] those with keen faculties and those with dull, those with good attributes and those with bad, those easy to teach and those hard, some of them seeing disgrace & danger in the other world.
"Having seen this, I answered Brahma Sahampati in verse:
'Open are the doors to the Deathless
to those with ears.
Let them show their conviction.
On other types of topic, "the truth" tends to be like an elephant (i.e. people's perception of it is subjective and partial):
- "He started!" -- "No, he started it!"
- "I am wronged!" -- "But what about [etc.]"
... which according to the Dhammapada might be "endless" if you're not careful, and which may call for a certain type of "neutrality".
Regardless, I think that Buddhism teaches that at least some things are an "absolute truth", and not only relative, for example (quoting from Getting the Message):
The early texts report that a group of wanderers, in a discussion with one of the Buddha's lay disciples, once accused the Buddha of not taking a position on any issue, and the disciple replied that they were mistaken. There was one issue on which the Buddha's position was very clear: what kind of behavior is skillful, and what kind of behavior is not. When the disciple later reported the conversation to the Buddha, the Buddha approved of what he had said. The distinction between skillful and unskillful behavior lies at the basis of everything the Buddha taught.
In making this distinction, the Buddha drew some very sharp lines:
"What is unskillful? Taking life is unskillful, taking what is not given... sexual misconduct... lying... abusive speech... divisive tale-bearing... idle chatter is unskillful. Covetousness... ill will... wrong views are unskillful. These things are called unskillful...
"And what is skillful? Abstaining from taking life is skillful, abstaining from taking what is not given... from sexual misconduct... from lying... from abusive speech... from divisive tale-bearing... abstaining from idle chatter is skillful. Lack of covetousness... lack of ill will... right views are skillful. These things are called skillful."
— MN 9
Killing is never skillful. Stealing, lying, and everything else in the first list are never skillful. When asked if there was anything whose killing he approved of, the Buddha answered that there was only one thing: anger. In no recorded instance did he approve of killing any living being at all. When one of his monks went to an executioner and told the man to kill his victims compassionately, with one blow, rather than torturing them, the Buddha expelled the monk from the Sangha, on the grounds that even the recommendation to kill compassionately is still a recommendation to kill — something he would never condone. If a monk was physically attacked, the Buddha allowed him to strike back in self-defense, but never with the intention to kill.
On the subject of "the elephant" I try to keep in mind:
- Ud 6.4 (a war of words, "wounding with weapons of the mouth", arguments that generate more heat than light)
- The definitions of "conceit" given by Ven. Yuttadhammo and by Wikipedia, given that canonically conceit is a major cause of dispute
- A "young Quaker" telling me once, "I'll discuss anything with anyone; but as soon it turns into an argument then I [...] walk away"
And I should possibly reference Right Speech also.
If someone violently attacks someone else, does Buddhism teach pacifying the attacker and defending the victim, or does it teach staying out?
As I remember it, when someone was going to make war on the Sakyans, the Buddha tried to dissuade them (verbally) -- but when that failed he (of course) didn't participate in the war.
If you want to know about "violence" specifically, I think it's not completely unheard of -- the Vinaya says something like, that if a monk is (physically) seized then "they may, desiring freedom, strike a blow".
My personal experience (if that's on-topic) of intervening in a fight is not extensive, but in an immediate emergency my recollection is of acting without a lot of introspection: see or hear a commotion; perceive who's involved; feel it would be better for it to be more peaceful; move to act on that intention. And you do it because you're there and you can. And it doesn't feel personal, it feels (rightly or wrongly) like a case of "anybody would have done the same, or should have if they could", or (for better or worse) "instinctive" (maybe like this quote, "I would have no hesitation") -- like saving somebody else from danger, from drowning. There's one instance I recall vividly, I don't regret (feel remorse about) doing it. I'm not proud of how skilfully I did it -- I grabbed the attacker's hair from behind and dragged him off -- but other people were already standing around shouting, apparently I computed that "direct action" was the solution then.
As for "defending the victim" perhaps that's always an option too, especially for a lay-person. I mean it's traditional for concientious objectors now to go to war as "stretcher-bearers" i.e. to help the victims. It must be a bit different for monks -- they can't give money to the Red Cross, obviously. I suppose the Vinaya even technically forbids their giving medical assistance (but possibly "first aid" would be another case of "do it if you have to, confess it afterwards").
One more thing on the subject of "lies and violence", one of the first things they had me memorize from school was La Fontaine's "The Wolf and the Lamb". With that, and with what I know of causus belli historically, it's entirely unsurprising to me, old news, that violence is associated with lies -- see also, "ultima ratio regum".
Given that, and given how it's possible to become swept up in unproductive argument -- if "the Wolf" will not take "no" for an answer, and if you have yourself renounced the "last argument of kings" -- then sometimes "the only winning move is not to play". Or to do it elsewhere -- "right speech" being "spoken at the right time".